INNER JOIN with ADO.NET

S

serge calderara

Dear all,

I am using an access 2000 database in my application and
VB.net.
I am able to handle simple querry on a unique table
without any troubles.
Now comes the fact that I need to execute a querry in
order to retrive information from an other table.

this works fine when I execute the following querry under
access just as a test purpose :

SELECT LANGUAGE.NAME, USER_PARAM.FIRST_NAME,
USER_PARAM.LAST_NAME, USER_PARAM.LANGUAGE_ID
FROM USER_PARAM INNER JOIN [LANGUAGE] ON
USER_PARAM.LANGUAGE_ID = LANGUAGE.ID
WHERE (((USER_PARAM.LANGUAGE_ID)=1));

The idea of that querry is to retrive the language name of
the LANGUAGE table of a user in USER_PARAM table by a
language_id number.

HOw can I pass this querry to be execute in ADO.net ?
I have seen some sample that create those relation in two
steps by fetching individual table data first and then
combine them in a relation object.

is it the only solution to handle multitable querry or is
there a simple way to just pass the sql querry and return
corresponinfg data?

thnanks for your help
regards
serge
 
W

William Ryan

You can just pass that statement in there provided it parses correctly.

The reason you want to normally use DataRelations instead has to do with
many things like not pulling over unneeded data and making update logic much
easier.

However, you can, if you feel you definitely want to, fire a join like that
but you probably want to do it with a DataReader b/c if you are going to use
Disconnected objects, go with the DataRelations.

HTH,

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top