join expression is not supported error
hello..kindly tell what's wrong with my code..
Set adoConnection = New adodb.Connection
Set adoRecordset = New adodb.Recordset
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\pis.mdb;"
adoConnection.Open connectionString
If adoConnection.State = adStateOpen Then
hold = "'" & txttitle.Text & "%" & "'"
Code:
sql1 = "Select pro_no,title from Project_Info Inner Join Project_Profile on Project_Profile.pro_no = Project_Info.pro_no And Project_Info.Title Like " & hold
adoRecordset.Open sql1, adoConnection, adOpenKeyset, adLockPessimistic, adCmdText
If Not adoRecordset.RecordCount <> 0 Then
End If
Else
MsgBox "Sorry. The connection could not be opened."
adoConnection.Close
End
End If
what do you mean by that error? join expression not supported.
Re: join expression is not supported error
Quote:
Originally Posted by puzzleofurheart_23
hello..kindly tell what's wrong with my code..
What's wrong is that you're using ADO rather than ADO.NET. I strongly suggest that you ditch that VB6 data access code and join the 21st century. The Data Access link in my signature has some ADO.NET code examples you should look at.
Quote:
Originally Posted by puzzleofurheart_23
what do you mean by that error? join expression not supported.
Your SQL code is invalid. You've essentially got this:
SQL Code:
SELECT C1, C2
FROM T1 INNER JOIN T2 ON T1.SomeColumn = T2.SomeOtherColumn
AND YetAnotherColumn LIKE @SomeValue
The AND operator at the end there implies that that last condition is part of the INNER JOIN, which is not valid. That condition should be part of the WHERE clause, which you don't have at all. The SQL code should be:
SQL Code:
SELECT C1, C2
FROM T1 INNER JOIN T2 ON T1.SomeColumn = T2.SomeOtherColumn
WHERE YetAnotherColumn LIKE @SomeValue