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附近错误。
------解决方案--------------------
where位置不对,还有后面多了个Set.
update 石灰窑生产信息 set 班别 ='',班次='',MgO='',SiO2='',S='' where 日期=''
基本的SQL操作语句,楼主要多多练习,总结!
------解决方案--------------------
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 + "'""