Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem dataset with datarelation to datagrid

Status
Not open for further replies.

SarahVandenbroucke

Programmer
Mar 4, 2003
14
BE
Hi,

I'm having some problems with my datagrid. Its datasource is a dataset, that has a datarelation:

objconnection = New OleDbConnection("provider=SQLOLEDB;" ..)
objconnection.Open()
objDataSet = New DataSet
objdataAdapt1 = New OleDbDataAdapter("select * from person", objconnection)
objdataAdapt2 = New OleDbDataAdapter("select * from Address", objconnection)
objdataAdapt1.Fill(objDataSet, "Person")
objdataAdapt2.Fill(objDataSet, "Address")
col1 = objDataSet.Tables("Person").Columns("p_person")
col2 = objDataSet.Tables("Address").Columns("p_person")
Relation = New DataRelation("Address", col1, col2)
objDataSet.Relations.Add(Relation)
objconnection.Close()
Datagrid.DataSource = objDataSet


I can run it fine, and it looks like in the manual.
But it's an ugly looking thing , with just the +sign and the 2 table names (in this case Person and Address)...

What I would like is parentrows, with its childrows, something like this, with expandable parentrows:
_____________________________________________________
+ Drinks
_____________________________________________________
Water
_____________________________________________________
Orange juice
_____________________________________________________
Cola
_____________________________________________________
+ Snacks
_____________________________________________________
Mars
_____________________________________________________
Snickers
_____________________________________________________
Chips
_____________________________________________________

Actually the looks of a treeview in a datagrid...

Does anyone have any idea where to find some information on this, or how to accomplish this?

Thanks in advance!

Sarah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top