sql中连接数据库并插入记录的问题,急啊!!!!!!!!!

来源:百度知道 编辑:UC知道 时间:2024/05/29 04:47:48
sql中连接数据库并插入记录的问题,急啊!!!!!!!!!

string conStr="User ID=sa;Password=123;Persist Security Info=False ;provider=SQLOLEDB.1;Data Source=(local)\\.;Initial Catalog=pro_buy_sell;Integrated Security=SSPI";
OdbcConnection cn=new OdbcConnection(conStr);
cn.Open();
string SringInsert;
SringInsert="insert into user(user_id,password,name,age,sex,telephone,describtion) values(textBox1.text,textBox2.text,textBox3.text,textBox4.text,textBox5.text,textBox6.text,textBox7.text,)";
OdbcCommand comom=new OdbcCommand(SringInsert,cn);
cn.Close();
高手帮我看看哪错了啊,谢谢

string conStr="User ID=sa;Password=123;Persist Security Info=False ;provider=SQLOLEDB.1;Data Source=(local)\\.;Initial Catalog=pro_buy_sell;Integrated Security=SSPI";
OdbcConnection cn=new OdbcConnection(conStr);
cn.Open();
string SringInsert;
SringInsert="insert into user(user_id,password,name,age,sex,telephone,describtion) values(textBox1.text,textBox2.text,textBox3.text,textBox4.text,textBox5.text,textBox6.text,textBox7.text,)";
OdbcCommand comom=new OdbcCommand(SringInsert,cn);
//加上一句
comom.executeNoquery();

cn.Close();

需要提交,这个程序你并没有写完。