【问题标题】:AccessDataSourcce update with where conditionAccessDataSource 使用 where 条件更新
【发布时间】:2013-05-29 02:56:17
【问题描述】:

尝试使用 Visual Studio 在 asp 中更新 access 数据库。

Dim accessDatabase2 As New AccessDataSource
accessDatabase2 = New AccessDataSource("Prestiege.accdb", "SELECT * FROM Rooms ;")
accessDatabase2.UpdateCommand = "UPDATE [Rooms] SET [Occupancy] = 1 Where [RoomType] = Single ;"
accessDatabase2.Update()

如果我删除 where条件,它可以正常工作。否则我会收到此错误:

Exception Details: System.Data.OleDb.OleDbException: No value given for one or more   required parameters.

谁能帮我解决这个问题?

【问题讨论】:

    标签: asp.net sql ms-access


    【解决方案1】:

    在给出字符串参数时尝试使用单引号

    accessDatabase2.UpdateCommand = "UPDATE [Rooms] SET [Occupancy] = 1 Where [RoomType] = 'Single';"
    

    【讨论】:

      猜你喜欢
      • 2012-12-11
      • 2013-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-02
      • 1970-01-01
      • 2015-09-25
      • 1970-01-01
      相关资源
      最近更新 更多