0

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

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.

谁能帮我这个?

4

1 回答 1

1

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

accessDatabase2.UpdateCommand = "UPDATE [Rooms] SET [Occupancy] = 1 Where [RoomType] = 'Single';"
于 2013-05-29T03:47:01.793 回答