Carlos kambui

Carlos kambui

  • NA
  • 499
  • 125.7k

using dot net devcompnents

Jan 11 2017 3:21 AM
i have table patient and table lab_trans, patient_id is primary key for table patient and foreign key in table lab_trans,i want to load table table patient as parent table and table lab_trans as child in datagridview / supergridcontroll.
below are my codes but i dont have idea how to it with data
Sub GetTest()
tDataSet = New DataSet()
Dim table As New DataTable
Dim column As New DataColumn
column.DataType = System.Type.GetType("System.Int32")
column.ColumnName = "Id"
column.AutoIncrement = True
column.AutoIncrementSeed = 1
column.AutoIncrementStep = 1
table.Columns.Add(column)
table.Columns.Add("patient_id", GetType(Integer))
table.Columns.Add("patient_no", GetType(String))
'table.Columns.Add("patient_no", GetType(String))
table.Columns.Add("sirname", GetType(String))
table.Columns.Add("other_names", GetType(String))
table.Columns.Add("contact", GetType(String))
table.Columns.Add("sex", GetType(String))
table.Columns.Add("age", GetType(Integer))
table.Columns.Add("height", GetType(Integer))
table.Columns.Add("weight", GetType(Integer))
table.Columns.Add("charges", GetType(Integer))
table.Columns.Add("blood_group", GetType(String))
table.Columns.Add("marital_status", GetType(String))
table.Columns.Add("location", GetType(String))
table.Columns.Add("contact_phone", GetType(String))
table.Columns.Add("contact_name", GetType(String))
patienttable = table
tDataSet.Tables.Add(patienttable)
'patienttable.Load(svcClient.GetPatients(MdlConn.checkDB))
table = New DataTable
column = New DataColumn
column.DataType = System.Type.GetType("System.Int32")
column.ColumnName = "Id"
column.AutoIncrement = True
column.AutoIncrementSeed = 1
column.AutoIncrementStep = 1
table.Columns.Add(column)
table.Columns.Add("lab_id", GetType(Integer))
table.Columns.Add("lab_trans_id", GetType(Integer))
table.Columns.Add("test_id", GetType(Integer))
table.Columns.Add("name", GetType(String))
table.Columns.Add("sdate", GetType(Date))
table.Columns.Add("description", GetType(String))
table.Columns.Add("results", GetType(String))
table.Columns.Add("patient_id", GetType(Integer))
testtable = table
tDataSet.Tables.Add(testtable)
tDataSet.Relations.Add("1", tDataSet.Tables("table1").Columns("patient_id"), tDataSet.Tables("table2").Columns("patient_id"), False)
Dim labtrans As New List(Of LabtransType)
'labtrans = svcClient.GetLabtrans(MdlConn.checkDB).Where(Function(x) x.approved = False).ToList()
' patienttable.ParentRelations()
SuperGridControl2.PrimaryGrid.DataSource = patienttable
SuperGridControl2.PrimaryGrid.DataMember = "table1"
End Sub
 kindly assists 
 

Answers (1)