hi this is SP that count row of table:
ALTER procedure [dbo].[CountOrderU]
as
begin
select count(*) from Order_Users as CountOrder
end
ANd
private void OrderCount()
{
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand _cmd = General.GetCommand("CountOrderU", conn))
{
conn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();
while (_dr.Read())
{
blsef1.Text = _dr["CountOrder"].ToString();
}
}
}
}
but when run page this error happen:
Server Error in '/' Application.
CountOrder
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: CountOrder
Source Error:
Line 44: while (_dr.Read())
Line 45: {
Line 46: blsef1.Text = _dr["CountOrder"].ToString();
Line 47:
Line 48: }
|
can you help me?
Best regards
Neda