getting an error saying "There is no row at position 1" using the below code to fill in a data grid. weird thing is, I only get the error every once in a while. can't pin point why the error is happening.
any help would be appreciated
Dim sql As String = "SELECT MyFields from MyTable where Field1 = '" & l8.Text & "' ORDER BY Field1"
Dim connection As New SqlConnection(strcn)
connection.Open()
sCommand = New SqlCommand(sql, connection)
sAdapter = New SqlDataAdapter(sCommand)
sBuilder = New SqlCommandBuilder(sAdapter)
sDs = New DataSet()
sAdapter.Fill(sDs, "Table")
sTable = sDs.Tables("Table")
dg1.DataSource = sDs.Tables("Table")
l14.Text = dg1.Rows.Count
any help would be appreciated
Dim sql As String = "SELECT MyFields from MyTable where Field1 = '" & l8.Text & "' ORDER BY Field1"
Dim connection As New SqlConnection(strcn)
connection.Open()
sCommand = New SqlCommand(sql, connection)
sAdapter = New SqlDataAdapter(sCommand)
sBuilder = New SqlCommandBuilder(sAdapter)
sDs = New DataSet()
sAdapter.Fill(sDs, "Table")
sTable = sDs.Tables("Table")
dg1.DataSource = sDs.Tables("Table")
l14.Text = dg1.Rows.Count