Code:
Private Sub frmSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sql1 As String
Dim sql2 As String
Dim da1 As SqlDataAdapter
Dim da2 As SqlDataAdapter
Dim con As SqlConnection
Dim ds As New DataSet
con = New SqlConnection(StrCon)
con.Open()
sql1 = "SELECT dbo.tbl_Case.CaseID, dbo.tbl_Case.CaseIDText, dbo.tbl_Client.FirstName, dbo.tbl_Client.ClientID, dbo.tbl_Client.Role
FROM dbo.tbl_Case INNER JOIN
dbo.tbl_Client ON dbo.tbl_Case.CaseID = dbo.tbl_Client.CaseID
WHERE (dbo.tbl_Client.Role = N'Ini')
sql2 = ""SELECT dbo.tbl_Case.CaseID, dbo.tbl_Case.CaseIDText, dbo.tbl_Client.FirstName, dbo.tbl_Client.ClientID, dbo.tbl_Client.Role
FROM dbo.tbl_Case INNER JOIN
dbo.tbl_Client ON dbo.tbl_Case.CaseID = dbo.tbl_Client.CaseID
WHERE (dbo.tbl_Client.Role <> N'Ini')
da1 = New SqlDataAdapter(sql1, con)
da2 = New SqlDataAdapter(sql2, con)
da1.Fill(ds, "Parent")
da2.Fill(ds, "Child")
Dim DataRelation As New DataRelation("Parent", ds.Tables("Parent").Columns("CaseID"), ds.Tables("Child").Columns("CaseID"))
ds.Relations.Add(DataRelation)
Dim dv As New DataView(ds.Tables("Parent"))
dgSearch.DataSource = dv
End Sub
This is the code that I have and I need to see parent and child record in my datagridview but I only get the parent table in my datagrid.
what is wrong with my code?
Please help me.
Comment