B
Bill Cart
I am very new at this C# stuff. I keep trying to understand it but I don't
seen to have a clue. I am trying to fill a DropDownList from a data adapter.
I have a web application. In the Global.asx I have
private System.Data.SqlClient.SqlConnection sqlConSWT;
private System.Data.SqlClient.SqlCommand sqlCmdAddDemoReq;
private System.Data.SqlClient.SqlDataAdapter sqlDaStates;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private DemoReqSql.dsStates dsStates;
In the web form I have
// redeclare the database stuff in the Global unit
System.Data.SqlClient.SqlCommand sqlCmdAddDemoReq;
System.Data.SqlClient.SqlDataAdapter sqlDaStates;
protected DemoReqSql.dsStates dsTryAgain;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
private void Page_Load(object sender, System.EventArgs e)
{
sqlDaStates.Fill(dsTryAgain);
DropDownList1.DataBind();
Something just like this works in another applications but I can't get this
to go at all. It look just like what is in the book. The error points to the
sqlDaStates.Fill(dsTryAgain); and says "Object reference not set to an
instance of an object". The data set is on the form, do I need to redeclare
it again? Or is there some sort of other error that I should be able to
infer?
seen to have a clue. I am trying to fill a DropDownList from a data adapter.
I have a web application. In the Global.asx I have
private System.Data.SqlClient.SqlConnection sqlConSWT;
private System.Data.SqlClient.SqlCommand sqlCmdAddDemoReq;
private System.Data.SqlClient.SqlDataAdapter sqlDaStates;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private DemoReqSql.dsStates dsStates;
In the web form I have
// redeclare the database stuff in the Global unit
System.Data.SqlClient.SqlCommand sqlCmdAddDemoReq;
System.Data.SqlClient.SqlDataAdapter sqlDaStates;
protected DemoReqSql.dsStates dsTryAgain;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
private void Page_Load(object sender, System.EventArgs e)
{
sqlDaStates.Fill(dsTryAgain);
DropDownList1.DataBind();
Something just like this works in another applications but I can't get this
to go at all. It look just like what is in the book. The error points to the
sqlDaStates.Fill(dsTryAgain); and says "Object reference not set to an
instance of an object". The data set is on the form, do I need to redeclare
it again? Or is there some sort of other error that I should be able to
infer?