简体   繁体   中英

Double Inner Join Query of Access 2007 db in vb.net

I'm having a problem jumping across multiple relational tables in an access 2007 database using aspx and vb.net. Sadly I have no control over 17+ table db structure or format.

The query i'm attempting to call works correctly in access but throws the following error when run through asp and vb.net.

No value given for one or more required parameters.

Tbl_A Structure:

ID (PK)
Device_SiteID (Linked to Tbl B)
StatusID
...

Tbl_B Structure

Device_SiteID
SiteID (Linked To Tbl_C)
...

Tbl_C Structure

SiteName
SiteID
...

code

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)
...

尝试将Timbucktoo括在引号='Timbucktoo'中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM