I'm having a problem where I exec a stored procedure (which SELECTs all rows
from a table, which has 100 rows) - each row has 8 columns.
When I exec the code (see below) I get 8 in oSQLDR.FieldCou nt (which I
expect but whenever I try and reference the data in the row
(oSQLDR.GetInt3 2(0);) I get an exception "invalid attempt to read when no
data is present". If I exec the SP in an ISQL window using: EXEC getEvents,
I get 100 rows returned.
What am I missing here ?
<snip>
oSqlCmd = new SqlCommand();
oSqlCmd.Connect ion = m_oSqlConnectio n; // A valid connection Object
is here
oSqlCmd.Command Text = "getEvents" ;
oSqlCmd.Command Type = CommandType.Sto redProcedure;
SqlDataReader oSQLDR = oSqlCmd.Execute Reader();
int iRows = oSQLDR.FieldCou nt;
iRowsAffected = oSQLDR.RecordsA ffected;
int iID = oSQLDR.GetInt32 (0);
<snip>
- peteZ
from a table, which has 100 rows) - each row has 8 columns.
When I exec the code (see below) I get 8 in oSQLDR.FieldCou nt (which I
expect but whenever I try and reference the data in the row
(oSQLDR.GetInt3 2(0);) I get an exception "invalid attempt to read when no
data is present". If I exec the SP in an ISQL window using: EXEC getEvents,
I get 100 rows returned.
What am I missing here ?
<snip>
oSqlCmd = new SqlCommand();
oSqlCmd.Connect ion = m_oSqlConnectio n; // A valid connection Object
is here
oSqlCmd.Command Text = "getEvents" ;
oSqlCmd.Command Type = CommandType.Sto redProcedure;
SqlDataReader oSQLDR = oSqlCmd.Execute Reader();
int iRows = oSQLDR.FieldCou nt;
iRowsAffected = oSQLDR.RecordsA ffected;
int iID = oSQLDR.GetInt32 (0);
<snip>
- peteZ
Comment