Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

sql - c# ConnectionContext and EF will not break DB connection -


i'm creating program transfers database 1 sql server (on 1 pc) local instance. after transferring, api (entity framework) going connect , run things on it. disconnect, , 2 sql scripts ran on via sqlcommand class. after that, database backed , saved , local, temporary database dropped. problem i'm running sqlcommand instance first connects (before transfer takes place) creates database, disconnects without issue (i check active connections via management studio). once entities context connects, context.dispose() call, doesn't disconnect. create server instance run sql scripts (located in sub folder) code similar this:

fileinfo file = new fileinfo(filename); string removerecords = file.opentext().readtoend(); file.opentext().close();  server srv = new server(new serverconnection(this.myscriptconn)); serverconnection srvconn = new serverconnection(); srvconn.nonpooledconnection = true; srvconn = srv.connectioncontext;  server server = new server(srvconn);  server.connectioncontext.executenonquery(removerecords);  server.connectioncontext.disconnect(); 

the disconnect call here doesnt break connection either. when go drop database, find can't because there 2 active connections. there i'm doing wrong here or i'm missing? nonpooledconnection = true found online try if disconnect didn't work didnt either. otherwise code like:

fileinfo file = new fileinfo(filename); string removerecords = file.opentext().readtoend(); file.opentext().close();  server server = new server(new serverconnection(this.myscriptconn)); server.connectioncontext.executenonquery(removerecords);  server.connectioncontext.disconnect(); 

i sure disconnecting prior connections before making new ones. way disconnect entities close program , not want obviously.

any appreciated, thanks.

i found out doing sqlconnection.clearallpools() fixes issue , disconnects active connections.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -