Click to See Complete Forum and Search --> : Getvalues method with data grid


kenone
February 23rd, 2006, 12:35 AM
Using VB.NET with SQL Server;
I just want to search records from two related tables Parent and Child and then display records on the form fields and data grid controls respectively.I can Load the data successfully using the Fill method.My concern here is how to search and display coresponding child records on the datagrid??I have
tried to use getvalues method but got some errors...below is my code

[Dim selcom As New SqlCommand()
Dim dr As SqlDataReader
Dim message As String
Dim values As Object()


selcom.Connection = SqlConnection1
selcom.CommandText = "select m.checkno, m.lastname,
m.othernames,t.paydate, t.basicpay, t.member_amount,
t.employer_amount, t.votecode, t.checkno, from members m
inner join transactions t on m.checkno = t.checkno where
(m.checkno='" & txtCheckNo.Text & "')"

SqlConnection1.Open()
dr = selcom.ExecuteReader
If dr.Read Then
txtCheckNo.Text = dr.GetValue(0)
txtLName.Text = dr.GetValue(1)
txtFName.Text = dr.GetValue(2)
txtVote.Text = dr.GetValue(3)
DataGrid1.Text = dr.GetValues(values)

Is there anything wrong with my code???Any other way around
to display the child records on data grid ???plz help