0 Replies - 613 Views - Last Post: 01 April 2013 - 09:17 AM Rate Topic: -----

#1 Black_Lion  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 31-March 13

Binding textboxes to database

Posted 01 April 2013 - 09:17 AM

Hello. I am using Microsoft Visual Web Developer 2010 Express. I have been trying to enter my textbox input into a database table I created. I ran into a problem using the DataBinding property (located under the BindTextBoxes method at the bottom). I searched the net and found out that the DataBinding propertiy does not exist in Web Developer. Is there an alternate way to transfer the textbox input into a database table?


    public partial class _Default : System.Web.UI.Page
    {
        //used to link textboxes with database

        BindingSource bsUserDetails = new BindingSource();

        //info stored in tables

        DataSet dsUserDetails = new DataSet();

        //manages connection between database and application

        SqlDataAdapter daUserDetails = new SqlDataAdapter();

        //create new SQL connection

        SqlConnection connUserDetails = new SqlConnection("Data           
        Source=.\SQLEXPRESS;AttachDbFilename=D:\Users\synthesis\Documents\Visual Studio 
        2010\Projects\Practical\Practical\App_Data\UserDetails.mdf;Integrated Security=True;User 
        Instance=True");


        protected void Page_Load(object sender, EventArgs e)
        {
            //link textboxes to relevant fields in the dataset

            bsUserDetails.DataSource = dsUserDetails;
            bsUserDetails.DataMember = dsUserDetails.Tables[0].ToString();

            //call BindTextBoxes Method 

            BindTextBoxes();


        private void BindTextBoxes()
        {
        txtBoxCell.DataBindings.Add(new Binding("Name entered into txtBox", bsUserDetails, "Name column in  
        database table", true));

        }

            

      }

   }








Is This A Good Question/Topic? 0
  • +

Page 1 of 1