473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Parent and Child Datagrid problem

77
Expand|Select|Wrap|Line Numbers
  1. Private Sub frmSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Dim sql1 As String
  3.         Dim sql2 As String
  4.         Dim da1 As SqlDataAdapter
  5.         Dim da2 As SqlDataAdapter
  6.         Dim con As SqlConnection
  7.         Dim ds As New DataSet
  8.  
  9.  
  10.         con = New SqlConnection(StrCon)
  11.         con.Open()
  12.         sql1 = "SELECT     dbo.tbl_Case.CaseID, dbo.tbl_Case.CaseIDText, dbo.tbl_Client.FirstName, dbo.tbl_Client.ClientID, dbo.tbl_Client.Role
  13. FROM         dbo.tbl_Case INNER JOIN
  14.                       dbo.tbl_Client ON dbo.tbl_Case.CaseID = dbo.tbl_Client.CaseID
  15. WHERE     (dbo.tbl_Client.Role = N'Ini')
  16.  
  17.         sql2 = ""SELECT     dbo.tbl_Case.CaseID, dbo.tbl_Case.CaseIDText, dbo.tbl_Client.FirstName, dbo.tbl_Client.ClientID, dbo.tbl_Client.Role
  18. FROM         dbo.tbl_Case INNER JOIN
  19.                       dbo.tbl_Client ON dbo.tbl_Case.CaseID = dbo.tbl_Client.CaseID
  20. WHERE     (dbo.tbl_Client.Role <> N'Ini')
  21.  
  22.  
  23.         da1 = New SqlDataAdapter(sql1, con)
  24.         da2 = New SqlDataAdapter(sql2, con)
  25.         da1.Fill(ds, "Parent")
  26.         da2.Fill(ds, "Child")
  27.         Dim DataRelation As New DataRelation("Parent", ds.Tables("Parent").Columns("CaseID"), ds.Tables("Child").Columns("CaseID"))
  28.         ds.Relations.Add(DataRelation)
  29.         Dim dv As New DataView(ds.Tables("Parent"))
  30.  
  31.         dgSearch.DataSource = dv
  32.  
  33.  
  34.     End Sub
  35.  
Hi all,

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.
Aug 11 '08 #1
1 1241
Sep410
77
I found it.
I was using datagridview instead of datagrid.
Aug 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is...
0
by: Ross | last post by:
ASP.NET Problem: I have a dataset with a parent table and a child table. For every row in the parent table there are ~1/2 dozen corresponding records in the child table. In the ASPX page I have a...
1
by: Roy | last post by:
How is it done? BTW, I'm reposting this here, as the datagrid newsgroup appears functionally comatose... I have a nested datagrid setup. When one updates the child grid using edit, it also...
3
by: Skowronek | last post by:
What is the best method to obtain a data value from a parent datagriditem from a child datagrid - datagrid footer item command event handler? Here is the layout of my asp.net controls ...
1
by: Andy | last post by:
Hello, I have a datagrid within another datagrid. The innder datagrid contains a dropdownlist which fires an event as index change (OnSelectedIndexChanged). I can get the ItemIndex of the...
4
by: Frank | last post by:
Hello, I have a dataset with 2 tables and a relation (parent - child). I linked that ds to a datagrid. Shows everything fine (very little coding for such functionality!). But.. in the child row I...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
0
by: Ambica Jain | last post by:
I have a data grid called Files, which has some columns like FileName, Col1, Col2, ... , Col8. Then i have a combobox which allows user to select from Col1 to Col8 and based on this selection, i...
0
by: Iain | last post by:
Hi All My apologies for posting this here but the Delphi newsgroup is very slow. Using Borland Developer Studio 2006 - creating a C# .net application. I have a datagrid (id = "Documents")...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.