它回复语法错误(missing operator) in query expression on the executereader
这是我运行查询时得到的值。
"Update [Birthdays] set [ID] = 'RH1' where [ID] = 'RH' and [Date] = '1/1/2014' and [Description] = 'New Year's Day'"
我的查询有错误吗?提前谢谢。
这是我的代码:
Private Sub DGHolidays_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGHolidays.CellEnter
Dim Row = DGHolidays.CurrentRow.Index
col1 = DGHolidays.Rows(Row).Cells(0).Value()
col2 = DGHolidays.Rows(Row).Cells(1).Value()
col3 = DGHolidays.Rows(Row).Cells(2).Value()
End Sub
Private Sub DGHolidays_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGHolidays.CellValueChanged
Dim Row = DGHolidays.CurrentRow.Index
Dim ColI = DGHolidays.CurrentCell.ColumnIndex
Dim Col = DGHolidays.Columns(ColI).HeaderText
If con.State = ConnectionState.Closed Then
con.Open()
End If
MessageBox.Show(DGHolidays.Rows(Row).Cells(ColI).Value.ToString())
Dim updatehol As OleDbCommand = New OleDbCommand("Update [Birthdays] set [" & Col & "] = '" & DGHolidays.Rows(Row).Cells(ColI).Value.ToString() & "' where [ID] = '" & col1 & "' and [Date] = '" & col2 & "' and [Description] = '" & col3 & "'", con)
updatehol.ExecuteReader()
答案 0 :(得分:0)
Erros是
updatehol.ExecuteNonquery()
代替updatehol.ExecuteReader()
<强> ExecuteNonQuery()
强>
<强> ExecuteReader()
强>
<强> ExecuteScalar()
强>