Click here to Skip to main content
15,946,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am always confused in the matter of when to open the connection and when not to open the connection in ADO.NET

please give anyone explanation in brief.

thank you
Posted

Can you send me, your code..., please
 
Share this answer
 
When, ever we will write, Query, and take, command object, and specify all parameters, which we take in tables, then after..before Executing Query, we have to open a connection, example:
C#
cnn.Open();
cm.ExecteNonQuery();
cnn.Close();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900