Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • CommandBuilder in ADO.NET

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 438
    Comment on it

    In ADO.NET while performing manipulations and crud operations with the SqlDataAdapter you can do it with number of ways.

    One way for this purpose is to use command builder class meant.

     

    The load of creating SQL queries can be decreased with the help of CommandBuilder . In other words we can say that, the CommandBuilder helps you to generate update, delete., and insert commands on a single database table for a data adapter.

     

     

      SqlDataAdapter adapter;
            DataSet ds;
            DataTable dt;
            string connstring = "database=student;server=.;user=sa;password=wintellect";
            private void Form1_Load(object sender, EventArgs e)
            {        
    
            }
            private void btndataset_Click(object sender, EventArgs e)
            {
                // Using DataSet
                adapter = new SqlDataAdapter("select * from student_detail", connstring);
                ds = new DataSet();
                adapter.Fill(ds);// fill the DataSet
                dGVshowrecord.DataSource = ds.Tables[0];// Binding DataGridView with DataSet
             }
            private void btnupdate_Click(object sender, EventArgs e)
            {
                SqlCommandBuilder cmb = new SqlCommandBuilder(adapter);// Creating instance of SqlCommandBuilder
                adapter.Update(ds);// updating changes
            }
            private void btnclear_Click(object sender, EventArgs e)
            {
                ds.Clear();// Clear the DataSet
            }
        }
    }

     

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: