Creating a view in a DataSet

  • Thread starter Thread starter Gerald Zukrigl
  • Start date Start date
G

Gerald Zukrigl

Hello Everyone!

I've been reading several books on this stuff now. I always read that a
dataSet is a socalled in memory database. this is nice, but I didn't find a
way to join two (or more) DataTables for to get a big common resultset.

This would be something like creating a view in DBMSs like ORACLE. Actually
I do need this for stuffing the content of some tables into a reporting
system.

I would need something like "select a.name, b.name from a, b where a.b_id =
b.id" where a and b are DataTables in the DataSet.

There is no real Database-connection in behind, so that i couldn't stuff the
complete select statement into the dataadapter. I would need this function
really in memory.

Any Ideas? Is the only way to achieve this by implementing the JOIN
operation on my own?

Thanks and best regards,

Gerald Zukrigl
Softwaredeveloper for AXAVIA Software GmbH
 
Hello Everyone!

I've been reading several books on this stuff now. I always read that a
dataSet is a socalled in memory database. this is nice, but I didn't find a
way to join two (or more) DataTables for to get a big common resultset.

This would be something like creating a view in DBMSs like ORACLE. Actually
I do need this for stuffing the content of some tables into a reporting
system.

The reason you didn't find this type of join is that it isn't supported in
ADO.NET :-) The logic behind this is that, basically, joins can be
difficult to update, they can return redundant data, and table data can be
out of sync... plus the "table-based" model of ADO.NET makes it great for
working with multiple databases.
I would need something like "select a.name, b.name from a, b where a.b_id =
b.id" where a and b are DataTables in the DataSet.

There is no real Database-connection in behind, so that i couldn't stuff the
complete select statement into the dataadapter. I would need this function
really in memory.

Any Ideas? Is the only way to achieve this by implementing the JOIN
operation on my own?

One suggestion would be to create a table in the dataset and populate it
via code with data from tables a and b. You would set a DataRelation
between tables a and b and then, for each row in the parent table, use the
GetChildRows method to get the related child row(s).

To be honest, the lack of joins in ADO.NET was a source of frustration for
me at first (as I had adopted that mindset in working with Oracle) but
after some use it does seem to simplify things a lot - I just have to code
a bit instead of hammering out a nasty view that probably won't update
anyway :-)
Thanks and best regards,

Gerald Zukrigl
Softwaredeveloper for AXAVIA Software GmbH

Hope this helps...

Cheers,
Tim
 
Back
Top