Opening and Closing
After declaring your connection and setting the Connection String, the next
thing to do is to open the connection, and also learn how to close it! ;)
Before you can perform any data reading or any forms of manipulation, you will
have to open the connection first. Every connection object has a method we call
Open as well as Close.
SQL:
VB: SqlConn.Open()
C#: SqlConn.Open();
OLE:
VB: OleConn.Open()
C#: OleConn.Open();
Wow pretty... simple isn't it? The Close() Method is the same as the Open.
Just call it and It will close the corresponding conneciton object....
like in... OleConn.Close()
I have created a Sample application (created in VB) for you to skim over;
just click 'Download Source Code' above. If there are any errors please inform
me!! :) Have fun and I hope this 'tutorial' helps ya ;)