Results 1 to 2 of 2

Thread: join expression is not supported error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Location
    philippines
    Posts
    98

    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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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:
    1. SELECT C1, C2
    2. FROM T1 INNER JOIN T2 ON T1.SomeColumn = T2.SomeOtherColumn
    3. 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:
    1. SELECT C1, C2
    2. FROM T1 INNER JOIN T2 ON T1.SomeColumn = T2.SomeOtherColumn
    3. WHERE YetAnotherColumn LIKE @SomeValue
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width