我使用aspx和vb.net在访问2007数据库中跳过多个关系表时遇到问题。遗憾的是,我无法控制17+表格db结构或格式。
我尝试调用的查询在访问时正常工作,但在通过asp和vb.net运行时会抛出以下错误。
No value given for one or more required parameters.
Tbl_A结构:
ID (PK)
Device_SiteID (Linked to Tbl B)
StatusID
...
Tbl_B结构
Device_SiteID
SiteID (Linked To Tbl_C)
...
Tbl_C结构
SiteName
SiteID
...
码
Dim path As String = System.Web.HttpContext.Current.Server.MapPath("..\abcd\db\db.accdb")
Dim dbCon As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+ path)
dbCon.Open()
Dim sql As String = ""
sql = "SELECT Tbl_FMOPM828.[StatusID] "
sql += "FROM Tbl_Sites "
sql += "INNER JOIN (LTbl_Device_Sites "
sql += "INNER JOIN Tbl_FMOPM828 "
sql += "ON LTbl_Device_Sites.[Device_SitesID] = Tbl_FMOPM828.[Device_SitesID]) "
sql += "ON Tbl_Sites.SitesID = LTbl_Device_Sites.SitesID "
sql += "WHERE ((Not(Tbl_FMOPM828.StatusID)=1) AND ((Tbl_Sites.SitesName)=Timbucktoo))"
Dim statusCmd As N`ew OleDbCommand(sql, dbCon)
...
答案 0 :(得分:0)
尝试将蒂姆布克图括在引号='廷巴克图'
中