Bind Database to Text Form

Results 1 to 2 of 2

Thread: Bind Database to Text Form

  1. #1
    Join Date
    Dec 1969

    Default Bind Database to Text Form

    I&#039;m having a problem binding a database column to a form value.<BR>I get an error with code, even though the code below is said to work in the two books I have. The error says <BR>&#039;System.Web.UI.WebControls.TextBox&#039 ; does not contain a definition for &#039;DataTextField&#039;. I couldn&#039;t find the reference to this in the help files.<BR><BR>&#060;asp:TextBox id="BarCode" runat="server" Width="66px"&#062;&#060;/asp:TextBox&#062;<BR><BR>And here is the other code that I connect to the DB with(and hopefully bind to the text field above:<BR><BR>string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/InetPub/wwwroot/Software Library/newinventory.mdb";<BR> string sql="Select * From Inventory,CheckList where [Inventory.BarCode]=[CheckList.BarCode]";<BR> <BR>OleDbConnection conn = new OleDbConnection(connString);<BR>OleDbDataAdapter da = new OleDbDataAdapter(sql,conn);<BR>DataSet oDS = new DataSet();<BR>da.Fill(oDS, "CheckList"); <BR><BR>BarCode.DataTextField = "BarCode";<BR>BarCode.DataTextValue = "BarCode";<BR>BarCode.Source= oDS.Tables["CheckList"].DefaultView;<BR>BarCode.DataBind();

  2. #2
    Join Date
    Dec 1969

    Default RE: Bind Database to Text Form

    I dont think you can bind the &#060;asp:textbox&#062; to the datalist.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts