Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Where want to use Conn.open and Conn.close in sql server. Whats the use of it.

Thanks in Advance.
Posted
Comments
thatraja 10-Feb-12 5:39am    
Probably you have to take a look at ADO.NET. Go to MSDN
Shanthoshshanmugam 10-Feb-12 5:41am    
Ok Thanks!!

yes, without using con.open() u can not fire a single query to database
 
Share this answer
 
Hi,
First of all understand the connected and disconnected architecture it will help u lot
 
Share this answer
 
conn.open()is used to connecting to database

conn.close()is used to disconnecting from database
 
Share this answer
 
Comments
Shanthoshshanmugam 10-Feb-12 5:30am    
ok without using open and close connection if we executes the query means what will happen?

Thanks in Advance
Nilesh Patil Kolhapur 10-Feb-12 5:46am    
without open connection u cant execute any single query on database
Shanthoshshanmugam 10-Feb-12 5:32am    
Without using it, all the operation is working correctly whats the difference between that?
Nilesh Patil Kolhapur 10-Feb-12 6:49am    
how its working let me know?
Espen Harlinn 11-Feb-12 5:13am    
5'ed!
If you don't know the use of it, your "want to use" makes no sense.

And this is not "Conn". There are few classes derived from System.Data.Common.DbConnection, see:

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx[^],
http://msdn.microsoft.com/en-us/library/system.data.common.dbconnection.open.aspx[^],
http://msdn.microsoft.com/en-us/library/system.data.common.dbconnection.close.aspx[^].

A quick answer should be enough: you want to use it because otherwise nothing can work.

—SA
 
Share this answer
 
v2
Comments
Espen Harlinn 11-Feb-12 5:13am    
5'ed!
Sergey Alexandrovich Kryukov 11-Feb-12 5:21am    
Thank you, Espen.
--SA

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