SQL query on Datatables [VB 2005]

M

Marchetto

Hi all.

I thought that it was a FAQ.... but I can't find answer so i post in
this NG.


I have a dataset with two datatables (dt1 and dt2) in my application.

I'd like to know if there is a way to execute a SQL query that join
both datatables like this :

SELECT dt1.field1
FROM dt1 INNER JOIN dt2 ON dt1.field1 = dt2.field1

The ideal result is a third datatable.

I would like to make this only with code, without any wizard because I
would like to learn : )

Sorry for my English....

Thank you in advance !
MarK
 
M

Marchetto

Hi Ken, first of all I would to say a big THANK YOU for your answer.

It isn't possible to run a query on datatables.... that's a bad news :
)

The problem is that I import data from 2 .CSV files into 2 datatables.

Is there no way to join this data without save all records in a
database ?

What is the much correct solution ? I don't care about performance... I
would like to use clean and good code.

Thank you again !
 
M

Marchetto

Cor, thank you for your answer.

It's very interesting !

But probably I need a database :-(

The query in my first post was only a simple example. In my application
probably I'll need to run a bit more complex query, with sorting and
filtering functions.

I hoped it was possible to work with datatables just like "phisical"
tables stored in a database.
In my mind the perfect solution is one where I can use directly SQL
statement on two or more datatables.

I'm a novice and, in every case, I appreciate your help very much.

A big THANK YOU.
 
M

Marchetto

It seemed to me a good solution to fill a datatable for every .csv file
I have.... but at this point I ask to me which is the right way.....

1) To use my .csv files as datasource and run query directly on these.

2) To export all data from .csv files to a database (SQL Express,
Access....)

3) To export all data from .csv files to an XML file and use it as a
database.

The bigger file has about 10.000 rows.... I don't like very much the
idea to install SQL Express on every client..... my application
generates only a structured report... and should be quite "light".

Please give me a suggestion on what way to start to walk into....

Thank you MVPs !
 
C

Cor Ligthert [MVP]

Marchetto,
1) To use my .csv files as datasource and run query directly on these.
Mostly the worsest from the bad ones
2) To export all data from .csv files to a database (SQL Express,
Access....)
Yes but than don't use your csv anymore. And try to avoid Access especially
the ammount of records as you wrote.
3) To export all data from .csv files to an XML file and use it as a
database.
This is in between not bad, but be aware that you should always read and
write complete XML files as with CSV. In the same way do you have to protect
that if the computer goes down you are not overwiting in that time your
inputfile. You are as well fast at your limit with what you want to do.
The bigger file has about 10.000 rows.... I don't like very much the
idea to install SQL Express on every client..... my application
generates only a structured report... and should be quite "light".
Just downloading and install.
Please give me a suggestion on what way to start to walk into....
That is probably impossibile for that we don't know your application enough,
which is normally not to describe in a newsgroup, so don't even try it in my
idea.

I hope this helps however something.

Cor
 
M

Marchetto

Cor, I really appreciate your help.

A tech department in my company uses a software of third parts that
doesn't provide any reporting system....so, with some command line
utility, I can export every data I need in comma separated values
files.

At this point I have to develop a simple (for you, not completely for
me :p ) application that shows these datas in a datagrid and provide a
structured report.

Up to now my biggest problem is to have a "menageable" data source.

I have to leave the idea to install SQL Express.... it's better to
export all to XML. No problem if a client crashes...because every time
my application starts I have to re-obtain datas from the source....the
database of the third parts software.

I hope I explained clearly enough...... my Italian is better than my
English : )

Another time.... THANK YOU.
 

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