V
VBM
I want to use the single connection and command object, Can anybody tell me
the best practice for the follwoing code....I get an error "There is already
an open DataReader associated with this Connection which must be closed
first. "
IDataReader result = myCommand.ExecuteReader();
myCommand.Parameters.Clear();
myCommand.CommandText = "SomeStoreProcName";
while(result.Read())
{
//Read or do someother oprations
//Set parameters for SomeStoreProcName
IDataReader rAccess = myCommand.ExecuteReader();
//read rAccess or do some oprations on it
rAccess.Close();
rAccess.Dispose();
}
result.close();
result.Dispose();
the best practice for the follwoing code....I get an error "There is already
an open DataReader associated with this Connection which must be closed
first. "
IDataReader result = myCommand.ExecuteReader();
myCommand.Parameters.Clear();
myCommand.CommandText = "SomeStoreProcName";
while(result.Read())
{
//Read or do someother oprations
//Set parameters for SomeStoreProcName
IDataReader rAccess = myCommand.ExecuteReader();
//read rAccess or do some oprations on it
rAccess.Close();
rAccess.Dispose();
}
result.close();
result.Dispose();