none
Joining Problem in Access DB RRS feed

  • Question

  • OleDbConnectionconn = getrConnected();
    stringquery = "select p.pName, s.sName from Products100 p join Suppliers300 s on s.sID=p.sID ";
    OleDbDataAdaptersdr = newOleDbDataAdapter(query, conn);
    DataTabledt = newDataTable();
     sdr.Fill(dt);
    returndt;

    Using above syntax I am getting following error message.
    How can solve this problem?
    Please inform me. 

    "Syntax error in FROM clause."

    • Moved by Katherine Xiong Tuesday, March 31, 2015 2:11 AM it is more appropriate
    Friday, March 27, 2015 7:35 PM

Answers

  • The issue is caused by your JOIN clause, in MS Access it must be defined explicit as INNER or an OUTER join; with INNER it works:

    select p.pName, s.sName 
    from 
         Products100 p 
         inner join 
         Suppliers300 s on s.sID=p.sID 


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Tuesday, March 31, 2015 11:07 AM

All replies