问题描述
此按钮单击应为b,以更新我使用的插入命令!良好的Dis代码无法正常工作,请帮我解决这个问题! this button click is supposed to b for update i used insert command! well dis code in not workin too pls help me on this!!! 无效 button2_Click_1( 对象 发送者, EventArgs e) //更新 void button2_Click_1(object sender, EventArgs e)//update { 字符串 add = textBox2.Text; string add = textBox2.Text; 字符串 date = dateTimePicker1.Value.ToString( "dd-MMM-yyyy" ); string date = dateTimePicker1.Value.ToString("dd-MMM-yyyy"); 字符串 预览; string previewed; 如果 (M.Checked == 真 ) { if (M.Checked == true) { 已预览= 是" ; } "YES"; } 其他 { 已预览= 否" ; } "NO"; } OleDbConnection 连接= 新 OleDbConnection (); connection.ConnectionString = OleDbConnection connection = new OleDbConnection(); connection.ConnectionString = @&"Provider = Microsoft.Jet. OLEDB.4.0;数据源= F:\ Fahad \ Database \ Database1.mdb;用户ID = admin;'' ; @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Fahad\Database\Database1.mdb;User Id=admin;"; OleDbCommand 命令= 新 OleDbCommand ( "插入详细信息(用户名,地址,DOB ,____)VALUES('' + xyz + &";'" +添加+ "'" ; +日期+ '" + ','" +预览+ ') ;&" ,连接); connection.Open(); OleDbCommand command = new OleDbCommand("INSERT INTO details(UserName,Address,DOB,____)VALUES('"+xyz+"'"+ add + "'" + date + "'" + "','" + previewed + "');", connection); connection.Open(); command.ExecuteNonQuery(); command.ExecuteNonQuery(); //语法错误(缺少运算符)查询表达式``aaa'xyz'. connection.Close(); connection.Close(); command.Dispose(); command.Dispose(); } 这篇关于我需要将其更改为更新操作!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
私有
private推荐答案