SQL Update不更新访问中的记录

时间:2016-03-22 14:41:35

标签: sql vb.net sql-update database-connection oledb

尝试在访问权限的表格中更新评论 ProgressValue 的值。最后的消息框弹出,但没有更改任何值。

 Sub UpdateWeeklyReport()
    Dim con As OleDbConnection
    Dim com As OleDbCommand
    con = New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\ProjectDatabase.mdb")


    com = New OleDbCommand("Update WeeklyReport Set Comment = @Comment, ProgressValue = @ProgressValue Where [EntryDate]='" & CBDate.SelectedValue.ToString & "' AND [AdminNo]=" & CBAdmin.SelectedValue & " AND [ClassCode]='" & CBClass.SelectedItem.ToString & "'", con)
    con.Open()
    com.Parameters.Add("@Comment", OleDbType.LongVarChar).Value = txtComment.Text
    com.Parameters.Add("@ProgressValue", OleDbType.Integer).Value = CBProgress.Text

    com.ExecuteNonQuery()
    con.Close()
    MessageBox.Show("Report Changed")
    intialconnection()
End Sub

结束班

0 个答案:

没有答案