tobey1
asked on
Easy One: How do I populate a RichTextBox with a cell from SQL Server?
Here is the code that I am using,
Dim sqlcom1 As SqlCommand = New SqlCommand("SELECT * " & _
"FROM TABEL1 " & _
"WHERE VAR1 = '" & cmb_VAR1.Text & "'")
Dim reader_recode As SqlDataReader
reader_recode = sqlcom1.ExecuteReader
While reader_recode.Read
rtb_DATA1.Text = reader_recode("DATA1")
End While
reader_recode.Close()
I get an error when using Option Strict On. If I turn that off, things are fine, but I would like to code this correctly.
Here is the error:
Option Strict On disallows implicit conversions from 'System.Object' to 'String'.
Any ideas?
Dim sqlcom1 As SqlCommand = New SqlCommand("SELECT * " & _
"FROM TABEL1 " & _
"WHERE VAR1 = '" & cmb_VAR1.Text & "'")
Dim reader_recode As SqlDataReader
reader_recode = sqlcom1.ExecuteReader
While reader_recode.Read
rtb_DATA1.Text = reader_recode("DATA1")
End While
reader_recode.Close()
I get an error when using Option Strict On. If I turn that off, things are fine, but I would like to code this correctly.
Here is the error:
Option Strict On disallows implicit conversions from 'System.Object' to 'String'.
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
0 example
say u have a table with the following fields
field1 field2 field3
and u want field 2 u would replace 0 to 1