S
SpotNet
Hi NewsGroup,
Hope this is the right news group for this. Programming data access code in
C#, .NET Framework 1.1, using OleDb classes. As an example I'm doing
something similar as such; Keeping it brief sorry about syntax...
OleDbConnection oledbcon = new OleDbConnection(dataSource);
OleDbCommand oledbcmd = oledbcon.Command(cmdText, commandType);
//commandType=StoredProcedure
oledbcmd.Parameters.Add("id", 5)
OleDbReader oleread = oledbcmd.ExecuteReader();
if (oleread.HasRows)
{
OleDbCommand oledbcmd_2 = oledbcon.Command(cmdText, commandType);
//commandType=StoredProcedure
while(oleread.Read())
{
oledbcmd_2.Parameters.Add("filterID", oleread.GetInt32(0));
oledbcmd_2.ExecuteNonQuery(); <----*******BANG (See
below)*********
oledbcmd_2.Parameters.Clear();
}
}
The rest is thoughtfully disposed of...
I'm told by InvalidOperationException class that there's already an
OleDbDataReader opened for the connection, close it before attempting
another. Two questions, 1) Does .NET consider, int
OleDbCommand.ExecuteNonQuery() a reader in a way? Despite returning an int.
Can I only have one OleDbDataReader per OleDbConnection occuring at a time?
Many Thanks and kind regards,
SpotNet.
Hope this is the right news group for this. Programming data access code in
C#, .NET Framework 1.1, using OleDb classes. As an example I'm doing
something similar as such; Keeping it brief sorry about syntax...
OleDbConnection oledbcon = new OleDbConnection(dataSource);
OleDbCommand oledbcmd = oledbcon.Command(cmdText, commandType);
//commandType=StoredProcedure
oledbcmd.Parameters.Add("id", 5)
OleDbReader oleread = oledbcmd.ExecuteReader();
if (oleread.HasRows)
{
OleDbCommand oledbcmd_2 = oledbcon.Command(cmdText, commandType);
//commandType=StoredProcedure
while(oleread.Read())
{
oledbcmd_2.Parameters.Add("filterID", oleread.GetInt32(0));
oledbcmd_2.ExecuteNonQuery(); <----*******BANG (See
below)*********
oledbcmd_2.Parameters.Clear();
}
}
The rest is thoughtfully disposed of...
I'm told by InvalidOperationException class that there's already an
OleDbDataReader opened for the connection, close it before attempting
another. Two questions, 1) Does .NET consider, int
OleDbCommand.ExecuteNonQuery() a reader in a way? Despite returning an int.
Can I only have one OleDbDataReader per OleDbConnection occuring at a time?
Many Thanks and kind regards,
SpotNet.