PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
[simplified] Reusability of objects in MySQL Connector/NET
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
[simplified] Reusability of objects in MySQL Connector/NET
![]() |
[simplified] Reusability of objects in MySQL Connector/NET |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
My previous post may be too confusing. This is the idea of my doubt: To do one single SELECT-type query, or one single INSERT-type query, I have no problems. To do multiple queries in a row, which objects can I reuse? Do I need to instantiate a new connection (MySqlConnection) object, a new command (MySqlCommand) object, and a new data reader (MySqlDataReader) object for each and every query? I guess this would work, but would it would be optimum in terms of time and resources? I tend to think it would not. Can I at least reuse the connections? I hope the answer to this is "yes". Can I reuse an instance of MySqlCommand in two queries in a row? This is where my serious doubts start. Can I reuse an instance of MySqlDataReader, too? Thanks for your help. Mochuelo. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Mochuelo,
While a DataReader is open, the Connection is in use exclusively by that DataReader. You will not be able to execute any commands for the Connection, including creating another DataReader, until the original DataReader is closed. HTH Elton Wang "Mochuelo" wrote: > Hi, > > My previous post may be too confusing. This is the idea of my doubt: > > To do one single SELECT-type query, or one single INSERT-type query, I > have no problems. > > To do multiple queries in a row, which objects can I reuse? Do I need > to instantiate a new connection (MySqlConnection) object, a new > command (MySqlCommand) object, and a new data reader (MySqlDataReader) > object for each and every query? I guess this would work, but would it > would be optimum in terms of time and resources? I tend to think it > would not. > > Can I at least reuse the connections? I hope the answer to this is > "yes". > > Can I reuse an instance of MySqlCommand in two queries in a row? This > is where my serious doubts start. > > Can I reuse an instance of MySqlDataReader, too? > > > Thanks for your help. > Mochuelo. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

