create table based on existing tables in a dataset, how ?

  • Thread starter Thread starter jeff
  • Start date Start date
J

jeff

hi all

i create a dataset with table a, b and c in it.
Is it possible for me to generate extra table (e.g. d) into this dataset
based on table a and table b (which already exist in this dataset) ?
note that creation of table d, include a LEFT JOIN between table a and b.

pls give me some suggestion / example on how to do it.

cheers,
 
Jeff,

Assuming you are using a database that supports the concept of passing
multiple resultsets (Sql server 2000 does), you can easily do the left join
inside your SQL and pass it back as a resultset to the SqlDataAdapter.Fill
call.

So for example, you have a stored procedure that fills out a,b,c .. in a
very simplistic way ---

Select something from a // Fills A
select something,somethingelse from b // Fills B
select somethingreallyelse from c // Fills C

You could simply add a fourth select at the end of it with the left join
between A and B in it.

Alternatively, you could call a SqlDataAdapter.Fill on the same dataset
again and it would add a new table (d).

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
Back
Top