"scott" wrote...
Im making a connection to a mySQL data base.
First suggestion, use a MySqlConnecion and MySqlDataReader instead...
http://dev.mysql.com/downloads/connector/net/1.0.html
I then use OdbcCommand to create a query and then execute
it using ExecuteReader. I then use the OdbcDataReader that
is returned to get the results. All is fine until I need
to run another query within the current reader.
You can't use the same reader for two different queries.
You can reuse the reader *variable* for a second reader.
I get an error message saying "There is already an open
DataReader associated with this Connection which must be
closed first".
Does any one know how I can run to readers,
one after another ?
Run the first reader, *close* it, and then use the second one...
MySqlCommand cmd = new MySqlCommand();
// Other things to do, as assigning the connection,etc ...
MySqlDataReader dr = cmd.ExecuteReader();
while (dr.Read() )
{
// Do whatever...
{
dr.Close();
// Assigning a new statement, etc ...
dr = cmd.ExecuteReader();
while (dr.Read() )
{
// Do whatever...
{
dr.Close();
// Bjorn A