Reputation: 71
I have a Dataset with 2 different tables. What I have to do is to display those tables in a DataGridView. What I have done with a reference is given below.
sqlCmd.CommandText = "AutomateKDB"
sqlCmd.CommandType = CommandType.StoredProcedure
sqlCmd.Connection = Connection
sqlCmd.ExecuteNonQuery()
sqlDaK1 = New SqlDataAdapter(sqlCmd)
sqlDaK1.Fill(Kds, "KA")
sqlCmdeA.CommandText = "AutomateeAudIT_KAData"
sqlCmdeA.CommandType = CommandType.StoredProcedure
sqlCmdeA.Connection = Connection1
sqlCmdeA.ExecuteNonQuery()
sqlDaeK1 = New SqlDataAdapter(sqlCmd)
sqlDaeK1.Fill(Kds, "eK")
GridKnowledge.DataSource = Kds
But this is not working. Please help me with this.
Thanks In Advance.,
Upvotes: 0
Views: 7992
Reputation: 11
You make view of two tables .
Note same field in tables, select one of them
Upvotes: 1
Reputation: 94625
You can use two different DataGridView or nest them. Take a look at MSDN article - Nested Grids for Hierarchical Data and Code Project article - DataGridView with hierarchical data binding
Upvotes: 1
Reputation: 13551
Here's a solution that was posted to the msdn forums sometime ago.
Alternatively, you might consider mixing winform and wpf, where I believe this is relatively easy...
Upvotes: 0