SqlDataAdapter保存 [英] SqlDataAdapter saving

查看:103
本文介绍了SqlDataAdapter保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道流程中发生了什么.在此代码中



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);
       }

推荐答案

步骤:
1.您创建了一个连接
2.您创建了一个要执行的查询
3.您使用连接和查询创建了适配器.
4.您创建了一个数据集
5.适配器在内部打开连接,使用查询,获取数据并将其导入数据集.
6.完成后,适配器关闭连接.

有关更多详细信息,请在此处阅读. http://msdn.microsoft.com/zh-cn/library/system.data.sqlclient.sqldataadapter.aspx"target =" _ blank"title =" New Window> ^ ].
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[^].


这篇关于SqlDataAdapter保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆