Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to know bihind the process what happend. in this code



private void button1_Click(object sender, EventArgs e)
       {
          SqlConnection con = new SqlConnection("initial catalog=ado;integrated security=yes");
          string str = "insert into model values('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"')";
          SqlDataAdapter adap = new SqlDataAdapter(str, con);
          DataSet ds = new DataSet();
          adap.Fill(ds);
       }
Posted
Updated 25-Jan-11 18:52pm
v3

1 solution

Steps:
1. You created a connection
2. You created a query to be executed
3. You created an adapter using the connection and query.
4. You created a dataset
5. Adapter internally opens up the connection, uses the query, gets the data and imports it into dataset.
6. Adapter closes the connection when done.

For more detail, have a read here[^].
 
Share this answer
 
Comments
suzeets 1-Feb-11 4:16am    
5. Adapter internally opens up the connection, uses the query, gets the data and imports it into dataset.


but in 5 step here. i have checked ds still empty

and output of this is one row saved in database.

how this data tobe saved. i want to know internal procees or which classes tobe used here...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900