string sql="select * from w ";
System.Data .OleDb .OleDbDataAdapter da1=new System.Data.OleDb.OleDbDataAdapter (sql,oleDbConnection1)
string insert ="insert into w (name,password) values('"+this.textBox1 .Text +"','"+this.textBox2 .Text +"')";
//da1.InsertCommand(insert);
this.Update ();
MessageBox.Show ("添加成功");请教大家,这样的代码要怎样改才可以在数据库中插入一条记录的啊,这个问题困饶我几天了。真的是太感谢大家了的啊!!!
System.Data .OleDb .OleDbDataAdapter da1=new System.Data.OleDb.OleDbDataAdapter (sql,oleDbConnection1)
string insert ="insert into w (name,password) values('"+this.textBox1 .Text +"','"+this.textBox2 .Text +"')";
//da1.InsertCommand(insert);
this.Update ();
MessageBox.Show ("添加成功");请教大家,这样的代码要怎样改才可以在数据库中插入一条记录的啊,这个问题困饶我几天了。真的是太感谢大家了的啊!!!
解决方案 »
- 对于Bitmap类结构图像进行放大,遇到Argument Exception异常
- 我能不能指定一些cookie值,然后用ie打开特定网址?
- 标准数据类型不匹配
- 如何遍历treeview中某个节点的子节点
- 请问哪里可以下载到《Microsoft C# Windows 程序设计》的示例代码?
- C#调用Delphi写的DLL时...参数对应问题...
- C#中使用webbroser控件
- 解决问题500分相谢~UP有分~!
- 请问为什么datagrid的这个属性 VB.NET有, C#没有?
- 如何传递一个combobox对象通过函数接口?
- 关于填充控件的背景颜色
- 如何改变TableControl上面标签的颜色呢
conn.open();string insert=...;
OleDbCommand cmd=new ...;
cmd.connection=conn;
cmd.commandtext=insert;
cmd.executenonquery();conn.close();
OleDbConnection con=new OleDbConnection ();
con.ConnectionString=conn;
con.open();
string insert ="insert into w (name,password) values('"+this.textBox1 .Text +"','"+this.textBox2 .Text +"')";
OleDbCommand com=new OleDbCommand (insert ,con);
com.executenonquery();
conn.close();
this.Update ();
MessageBox.Show ("添加成功");
http://blog.csdn.net/knight94/archive/2006/03/17/627556.aspx如果直接运行Command,如上就可以了