|
-
September 2nd, 2011, 06:19 PM
#1
SQLAdapter / MySQLAdapter
I am trying to figure out how the MySqlDataAdapter/ SqlDataAdapterwith a connection object. I switched over from Sql to MySQL but both objects behave the same.
For example in the following code I have my adapter object, and I supply it a Sql string and a connection object which is a MySqlConnection object.
Code:
adapter = new MySqlDataAdapter(Sql, connection);
Now with my application I have a connect button to connect yourself to the database which then populates the connection object which can be supplied throughout my program. Before I connect if I try issuing any command to the adapter it bombs out and I catch an exception because my connection object is null. But lets say I connect then disconnect, now my connection object is technically not connected but is not null. If I execute any command to my adapter it works despite the connection object being a closed state.
So my question is, does the MySQLDataAdapter / SQLDataAdapter reopen the connection again?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|