Link to home
Start Free TrialLog in
Avatar of ParanoidOne
ParanoidOne

asked on

Oledbdataadapter, doing a left outer join give an error

How can I accomplish a left outer join with the Oledbdatadapter, I get an error when the statement is run !
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

What error ? Whats the code ?
Avatar of ParanoidOne
ParanoidOne

ASKER

I coughs up an error as soon as you leave the Query Designer, basically saying the statement will not work. I tried the same statement using the sqldataadapter and it does not work. It is something about Foxpro and the ODBC and OLEDB not allowing a left outer join.
I am sorry, type there. the SQLDataAdapter DOES allow the statement.
What type of database are you accessing?

Bob
It is a set of DBF files, a directory containing about 10 of them. They are either Informix or Foxpro but normally the Foxpro setup seems to work fine, something like the OLEDbDataAdapter
Are you using the Visual FoxPro OleDb provider?

Bob
Yeah I have used both.
What does the SQL statement look like?

Bob
Something like this, but the field names being different of course. This simple statement will run on the SQL adapter but not with the Oledb. The error is "Command contains unrecognized phrase/keyword.

SELECT     table1.id, table1.type, table2.descript
FROM         { oj table1 LEFT OUTER JOIN
                      table2 ON table1.type = table2.type }
Did you try it like this:

SELECT     table1.id, table1.type, table2.descript
FROM         table1 LEFT OUTER JOIN
                      table2 ON table1.type = table2.type

Bob
THe designer will pop the other characters back into the statement and still pop out an error.
Does it run in the designer with those characters?

Bob
No.
I'm sorry, I meant to say, "Does it run in the designer without those characters?"

Bob
Nope, I tried that too.
BTW I think it will require a UNION to work. From some reading Foxpro does not allow a LEFT OUTER JOIN
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That is the website I read it on. Unfortunately his example does not seem to work for me, well it does work just not as intended for my purposes. I am still trying some stuff though.
What kind of problems are you having with the UNION statement?

Bob
It appears to only give the information that is in both tables, instead of all of the information on the left. The end result I wanted was a left outer join.
That's where this comes into play:

SELECT a.keyfield,;
          a.datafield1,;
          000.00,;
          000.00;
     FROM a;
     WHERE a.keyfield NOT IN;
     (SELECT b.keyfield;
          FROM b)

Give me everything that is not in table b.

Bob