i wana retrive data from oracle database, depending on the value user enter
but i always get an error
"operation not valid due to current stat of object"
i think the error comes from if " If dr.HasRows Then "
here is the code please help
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim dt As DataTable = DirectCast(ViewState("CurrentTable"), DataTable)
Dim rowIndex As Integer = 0
Dim strEMPBRTDAT As String
Dim strEMPPRJCDE As String
Dim strEMPBRN As String
If dt.Rows.Count > 0 Then
For i As Integer = 0 To dt.Rows.Count - 1
Dim box1 As TextBox = DirectCast(Gridview1.Rows(rowIndex).Cells(1).FindControl("TextBox1"), TextBox)
Dim box2 As TextBox = DirectCast(Gridview1.Rows(rowIndex).Cells(2).FindControl("TextBox2"), TextBox)
Try
If box1.Text.Length <> 0 Then
dr = conn.MyReader("SELECT EMPNAM, EMPBRTDAT, EMPPRJCDE, EMPBRN, EMPNBR FROM EMPBAS WHERE(EMPNBR =':box1.Text' )")
Response.Write("box1:" + box1.Text + "")
If dr.HasRows Then
While dr.Read()
box2.Text = dr(0).ToString
strEMPBRTDAT = dr(1).ToString
'strEMPPRJCDE = dr(2).ToString
' strEMPBRN = dr(3).ToString
' Console.WriteLine(dr("strEMPBRTDAT"))
' Console.WriteLine(dr("strEMPPRJCDE"))
' conn.MyInsertclnc("insert into CLNCVST (EMPNAM , EMPNBR , EMPBRTDAT , EMPPRJCDE , EMPBRN ) values('" + box1.Text + "','" + box2.Text + "', '" + strEMPBRTDAT + "','" + strEMPPRJCDE + "' , '" + strEMPBRN + "' )")
End While
End If
Response.Redirect("www.gogo.com")
End If
Catch ex As Exception
Response.Write("<script>alert('the select : " + ex.Message.ToString + "') </script>")
Finally
'dr.Close()
End Try
rowIndex += 1
Next
End If
End Sub