E
enantiomer
I am running into some problems when running a pretty simple asp.net
page that was mostly generated from vs.net.
vs generated the code that sets up my sqlConnection, SqlDataAdapter,
and DataSet objects for my aspx.cs class. When trying to fill my
DataSet object in Page_Load with the SqlDataAdapter that was
initialized in InitializeComponent, it doesn't actually fill the
DataSet with anything (I check to make sure that the Rows.Count is >
0).
When I move over the initialization of my SqlDataAdapter up to
Page_Load method, the dataset can then be filled. I was under the
impression that InitializeComponent(which is called in OnInit) would
be called before Page_Load, and thus mySqlDataAdater would be properly
initialized to Fill my DataSet... Anybody have any ideas? Below is a
snippet of code that I use to initialize and fill with... Thanks,
Jon
__________begin code snippet__________________
String temp = String.Format("SELECT username, password, usertype, id,
name, address, city, state FROM [user] WHERE (username = '{0}') AND
(password = '{1}')",
(string)userNameBox.Text,(string)passwordBox.Text);
sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(temp,
sqlConnection1);
ds = new System.Data.DataSet();
sqlDataAdapter1.Fill(ds, "user");
if(ds.Tables["user"].Rows.Count > 0 && IsPostBack)
{ ... do stuff ....
___________end code snippet______________________
page that was mostly generated from vs.net.
vs generated the code that sets up my sqlConnection, SqlDataAdapter,
and DataSet objects for my aspx.cs class. When trying to fill my
DataSet object in Page_Load with the SqlDataAdapter that was
initialized in InitializeComponent, it doesn't actually fill the
DataSet with anything (I check to make sure that the Rows.Count is >
0).
When I move over the initialization of my SqlDataAdapter up to
Page_Load method, the dataset can then be filled. I was under the
impression that InitializeComponent(which is called in OnInit) would
be called before Page_Load, and thus mySqlDataAdater would be properly
initialized to Fill my DataSet... Anybody have any ideas? Below is a
snippet of code that I use to initialize and fill with... Thanks,
Jon
__________begin code snippet__________________
String temp = String.Format("SELECT username, password, usertype, id,
name, address, city, state FROM [user] WHERE (username = '{0}') AND
(password = '{1}')",
(string)userNameBox.Text,(string)passwordBox.Text);
sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(temp,
sqlConnection1);
ds = new System.Data.DataSet();
sqlDataAdapter1.Fill(ds, "user");
if(ds.Tables["user"].Rows.Count > 0 && IsPostBack)
{ ... do stuff ....
___________end code snippet______________________