I am trying to get a listing of all records in a dataset to display in a table. I have tried several options I have found through research and get no where. Anyone have any easier ideas? Being new to programming in general, this have given me fits. Here's the last thing I tried:
strSQL = "Select * from Safety_Data where xref_id=" & strTypePull & "and Shift_ID=" & strShiftPull & "and Date='" & strSelDate & "'"
Dim objDataSet As New Data.DataSet
Dim objConn As New Data.SqlClient. SqlConnection(" Data Source=XXXXXX;I nitial Catalog=XXXXXX; User ID=XXXXXX;passw ord=XXXXXX;")
Dim objCmd As New Data.SqlClient. SqlDataAdapter( strSQL, objConn)
objConn.Open()
objCmd.Fill(obj DataSet)
Dim objDC As Data.DataColumn
Dim objDT As Data.DataRow
For Each objDT In objDataSet.Tabl es(0).Rows
For Each objDC In objDataSet.Tabl es(0).Columns
txtRecID = objDataSet.Tabl es(0).Rows(0)(" RID").ToString( )
txtDate = objDataSet.Tabl es(0).Rows(0)(" Date").ToString ()
txtShift = objDataSet.Tabl es(0).Rows(0)(" Shift_ID").ToSt ring()
txtType = objDataSet.Tabl es(0).Rows(0)(" Xref_ID").ToStr ing()
TxtOccNotes = objDataSet.Tabl es(0).Rows(0)(" Notes").ToStrin g()
Next
Next
strSQL = "Select * from Safety_Data where xref_id=" & strTypePull & "and Shift_ID=" & strShiftPull & "and Date='" & strSelDate & "'"
Dim objDataSet As New Data.DataSet
Dim objConn As New Data.SqlClient. SqlConnection(" Data Source=XXXXXX;I nitial Catalog=XXXXXX; User ID=XXXXXX;passw ord=XXXXXX;")
Dim objCmd As New Data.SqlClient. SqlDataAdapter( strSQL, objConn)
objConn.Open()
objCmd.Fill(obj DataSet)
Dim objDC As Data.DataColumn
Dim objDT As Data.DataRow
For Each objDT In objDataSet.Tabl es(0).Rows
For Each objDC In objDataSet.Tabl es(0).Columns
txtRecID = objDataSet.Tabl es(0).Rows(0)(" RID").ToString( )
txtDate = objDataSet.Tabl es(0).Rows(0)(" Date").ToString ()
txtShift = objDataSet.Tabl es(0).Rows(0)(" Shift_ID").ToSt ring()
txtType = objDataSet.Tabl es(0).Rows(0)(" Xref_ID").ToStr ing()
TxtOccNotes = objDataSet.Tabl es(0).Rows(0)(" Notes").ToStrin g()
Next
Next
Comment