I am trying to read data from an Access database and to load it in a textbox.
I have managed to communicate with the database, but whenever i try to load the data in the textbox using the following code:
-------------------------------------------------------------------
String strSQLdetails = "SELECT Company FROM Companies WHERE Cust_ID = " + lbxcomps.SelectedItem.Value;
OleDbCommand objCommand = new OleDbCommand(strSQLdetails, objConnection);
objConnection.Open();
company.DataSource = objCommand.ExecuteReader();
company.DataTextField = "Company";
company.DataBind();
objConnection.Close();
-------------------------------------------------------------------
i get an error saying:
CS0117: System.Web.UI.WebControls.TextBox does not contain a definition for DataSource
I have looked everywhere trying to figure out what that error means, but no luck!
I have also managed to load the data from the database into a datagrid.
However, that is not what i need! I want isolated values to be loaded in separate textboxes.
Basically, i suppose i need a control equivalent to DataSource, that would work with TextBox.
--ListBox supports DataSource.
--TextBox supports ???????????
Any help would be greatly appreciated.
Thanks.
Menelaos.
I have managed to communicate with the database, but whenever i try to load the data in the textbox using the following code:
-------------------------------------------------------------------
String strSQLdetails = "SELECT Company FROM Companies WHERE Cust_ID = " + lbxcomps.SelectedItem.Value;
OleDbCommand objCommand = new OleDbCommand(strSQLdetails, objConnection);
objConnection.Open();
company.DataSource = objCommand.ExecuteReader();
company.DataTextField = "Company";
company.DataBind();
objConnection.Close();
-------------------------------------------------------------------
i get an error saying:
CS0117: System.Web.UI.WebControls.TextBox does not contain a definition for DataSource
I have looked everywhere trying to figure out what that error means, but no luck!
I have also managed to load the data from the database into a datagrid.
However, that is not what i need! I want isolated values to be loaded in separate textboxes.
Basically, i suppose i need a control equivalent to DataSource, that would work with TextBox.
--ListBox supports DataSource.
--TextBox supports ???????????
Any help would be greatly appreciated.
Thanks.
Menelaos.