datagrid columns from different datatables help

  • Thread starter Thread starter strongmace
  • Start date Start date
S

strongmace

Sorry to the mods: I posted this in asp.net forum but I think its more
appropriate here?

Anyways:

Hi. I'm rather new to vs.net so explaining things in detail would be
of great help to me. I'm working on a WebForms Project.

Basically I have a datagrid I need to populate. I have it set up so
that it will connect to my database (did not use the wizard btw) and
I can make it display things. However I've run into a problem.

I have 8 columns I need to populate but each one is from a different
table. The auto populate at runtime does not do what I need it to do.
Given any 8 tables (table1 through table 8) located in Database1, how
would I set up my 8 columns and populate each one from a different
table? In addition, how would I populate them with conditions, i.e.
fill this table with values only when in the january through june
months. The datatables do not share values so I dont think inner
join will work


Thank you.
 
I would iterate the rows of a basedatatable and then use the compute method
of each corresponding data table to fill the base table.
assuming there is some relation between all the tables from the base table.
Regardless, the compute method of a datatable can use expressions to filter
down to the data

For each drow in basetable.rows
'Create some computational query strings
Dim basevalue as string
Dim comp1 as string = "Somedate >= #1/1/2004# and somedate < #5/1/2004#
and basevalue = '" & basevalue & "'"
Dim comp2 as String = "Somefield = '" & basevalue & "'"
Dim comp3 as String = "SomeBool = True'

drow(comp1) = comptable1.compute("sum(compcolumn)", comp1)
drow(comp2) = comptable2.compute("count(compcolumn)",comp2)
drow(comp3) = comptable3.compute("count(anycolumn)".comp3)

Next


strongmace said:
Sorry to the mods: I posted this in asp.net forum but I think its more
appropriate here?

Anyways:

Hi. I'm rather new to vs.net so explaining things in detail would be
of great help to me. I'm working on a WebForms Project.

Basically I have a datagrid I need to populate. I have it set up so
that it will connect to my database (did not use the wizard btw) and
I can make it display things. However I've run into a problem.

I have 8 columns I need to populate but each one is from a different
table. The auto populate at runtime does not do what I need it to do.
Given any 8 tables (table1 through table 8) located in Database1, how
would I set up my 8 columns and populate each one from a different
table? In addition, how would I populate them with conditions, i.e.
fill this table with values only when in the january through june
months. The datatables do not share values so I dont think inner
join will work


Thank you.
 
Back
Top