I have this query:
Public Sub LoadList(ByVal InvNo As String)
Dim params As ListDictionary = New ListDictionary
Dim query As String
params.Add(_tblAPInvSub.ColumnNames.InvNo, InvNo)
query = "SELECT tblAPInvSub.InvNo, tblAPInvSub.GLCode,
tblGLAccounts.GLName, tblAPInvSub.SLCode,tblSLAccounts.SLName,
ISNULL(tblAPInvSub.DRAmt,0) AS DRAmt, ISNULL(tblAPInvSub.CRAmt,0) AS
CRAmt, tblAPInvSub.LineID " & _
"FROM tblAPInvSub INNER JOIN tblGLAccounts ON
tblAPInvSub.GLCode = tblGLAccounts.GLCode " & _
"INNER JOIN tblSLAccounts ON tblAPInvSub.SLCode =
tblSLAccounts.SLCode" & _
"WHERE tblAPInvSub.InvNo = @InvNo "
LoadFromSql(query, params, CommandType.Text)
End Sub
Of I omit the where
clause it will work, else it will return the error:
Incorrect syntax near 'tblAPInvSub'
Any idea why this is happening?
在tblSLAccounts.SLCode
之后或WHERE
之前放置一个空格
try like this
select * from
(
<your long query what you posted>
)x
WHERE tblAPInvSub.InvNo = @InvNo
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.