A
Andy Sutorius via DotNetMonster.com
Hi,
I am pulling my hair out! I don't see why I am getting the error message.
There is data in the data reader. Notice that I have actually performed a
while/read on the data reader. Does anyone see why I am getting this error?
Thanks,
Andy
private void BindTypeDropDown()
{
SqlConnection oConn = new SqlConnection(DBConnectionString);
SqlCommand lCommand = new SqlCommand("sp_web_835_ddl_type",oConn);
lCommand.CommandType=CommandType.StoredProcedure;
oConn.Open();
SqlDataReader dtrTypeDDL = lCommand.ExecuteReader();
// while (dtrTypeDDL.Read())
// {
// Response.Write(dtrTypeDDL["code_value"] + " " + dtrTypeDDL
["short_description"] + "<br>");
// }
// Response.End();
ddlType.DataSource = dtrTypeDDL;
ddlType.DataValueField = "code_value";
ddlType.DataTextField = "short_description";
ddlType.DataBind();
dtrTypeDDL.Close();
oConn.Close();
}
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 87: // Response.End();
Line 88:
Line 89: ddlType.DataSource = dtrTypeDDL;
Line 90: ddlType.DataValueField = "code_value";
Line 91: ddlType.DataTextField = "short_description";
Source File: c:\inetpub\wwwroot\ecui_1\wpclaimansi835data.aspx.cs Line:
89
I am pulling my hair out! I don't see why I am getting the error message.
There is data in the data reader. Notice that I have actually performed a
while/read on the data reader. Does anyone see why I am getting this error?
Thanks,
Andy
private void BindTypeDropDown()
{
SqlConnection oConn = new SqlConnection(DBConnectionString);
SqlCommand lCommand = new SqlCommand("sp_web_835_ddl_type",oConn);
lCommand.CommandType=CommandType.StoredProcedure;
oConn.Open();
SqlDataReader dtrTypeDDL = lCommand.ExecuteReader();
// while (dtrTypeDDL.Read())
// {
// Response.Write(dtrTypeDDL["code_value"] + " " + dtrTypeDDL
["short_description"] + "<br>");
// }
// Response.End();
ddlType.DataSource = dtrTypeDDL;
ddlType.DataValueField = "code_value";
ddlType.DataTextField = "short_description";
ddlType.DataBind();
dtrTypeDDL.Close();
oConn.Close();
}
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 87: // Response.End();
Line 88:
Line 89: ddlType.DataSource = dtrTypeDDL;
Line 90: ddlType.DataValueField = "code_value";
Line 91: ddlType.DataTextField = "short_description";
Source File: c:\inetpub\wwwroot\ecui_1\wpclaimansi835data.aspx.cs Line:
89