sql更新数据报错?
m_dal.ConnectionOpen()
Dim sql As String
sql = "update 石灰窑生产信息 where 日期 = '" + Me.DataGridView1.Rows(i).Cells(1).Value + "'"
sql += "set 班别 ='" & Me.DataGridView1.Rows(i).Cells(2).Value & "',
班次='"&Me.DataGridView1.Rows(i).Cells(3).Value & "'"
sql += "set MgO='" & Me.DataGridView1.Rows(i).Cells(26).Value & "',SiO2='" & Me.DataGridView1.Rows(i).Cells(27).Value & "',S='" & Me.DataGridView1.Rows(i).Cells(28).Value & "'"
m_dal.InsertDelUpdateRecord(sql)
提示where附近错误。
[解决办法]
update 石灰窑生产信息 set 班别 ='',班次='',MgO='',SiO2='',S='' where 日期=''
sql = "update 石灰窑生产信息
sql += "set 班别 ='" & Me.DataGridView1.Rows(i).Cells(2).Value & "',
班次='"&Me.DataGridView1.Rows(i).Cells(3).Value & "'"
sql += " ,MgO='" & Me.DataGridView1.Rows(i).Cells(26).Value & "',SiO2='" & Me.DataGridView1.Rows(i).Cells(27).Value & "',S='" & Me.DataGridView1.Rows(i).Cells(28).Value & "' where 日期 = '" + Me.DataGridView1.Rows(i).Cells(1).Value + "'""