Hi
i am new in .Net2.0,Before this i had familier with .net1.0.
i had written the code for insertion of values in database throgh form & i m getting it successful,Now i want to display the database values in the respective textboxes as i selected one value from the listbox on the selectedindex_changed event.
for this i had written the following code.
Private Sub LoadSelectedRecord()
Dim con As OracleConnection
Dim cmd As OracleCommand
Dim dr As OracleDataReader
Dim strSelect As String
Try
strSelect = "SELECT * FROM tblTimingMaster WHERE sTimingName = '" & Replace(lstsearch.Text, "'", "''") & "'"
con = New OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings("DeepakConnectionString").ConnectionString)
con.Open()
cmd = New OracleCommand(strSelect, con)
dr = cmd.ExecuteReader()
' Loop through the result set using the datareader class.
' The datareader is used here because all that is needed
' is a forward only cursor which is more efficient.
Do While dr.Read()
txtenglish.Text = dr.Item("sTimingName")
If Not IsDBNull(dr.Item("sTimingNameInMarathi")) Then
txtmarathi.Text = dr.Item("sTimingNameInMarathi")
Else
txtmarathi.Text = ""
End If
If Not IsDBNull(dr.Item("sTimingNameInGujrathi")) Then
txtgujrati.Text = dr.Item("sTimingNameInGujarati")
Else
txtgujrati.Text = ""
End If
If Not IsDBNull(dr.Item("sTimingNameInKannada")) Then
txtkannada.Text = dr.Item("sTimingNameInKannada")
Else
txtkannada.Text = ""
End If
Loop
dr.Close()
cmd.Dispose()
con.Close()
'con.Dispose()
Catch e As OracleException
MsgBox(e.Message, MsgBoxStyle.Information, "Deepak Fertilizer")
Catch e As Exception
MsgBox(e.Message, MsgBoxStyle.Information, "Deepak Fertilizer")
End Try
End Sub
then called this method on selectedindex_changed event of listbox.
but don't able to get the desired outpt. & getting the message that unable to find the specified column in result set.....why this is so??????
reply me as soon as possible.
thanx!!!