我正在尝试将此Update命令传递给数据库,它完成没有错误,但它没有更新数据库,我不明白为什么?
原文链接:https://www.f2er.com/vb/255887.htmlDim Cmd As OleDbCommand Dim sql As String Dim objCmd As New OleDbCommand Dim Con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & My.Settings.MasterPath) Dim Item = "08/08/2015" sql = ("UPDATE [Hol Dates] SET [" & EmployeeList.Text & "]= @Htype WHERE [HDate]=@Hdate") Cmd = New OleDbCommand(sql,Con) objCmd = New OleDbCommand(sql,Con) objCmd.Parameters.AddWithValue("@Hdate",item) objCmd.Parameters.AddWithValue("@Htype","None") Con.Open() Dim ans = MsgBox("Do you want to unbook this holiday?",MsgBoxStyle.YesNo) If ans = MsgBoxResult.Yes Then objCmd.ExecuteNonQuery() Else Exit Sub End If Con.Close() Con.Dispose()