Check tinytext column in MySQL Database with VB.NET
-
Hello all,I am wondering anyone can guide me how to read tiny text column for MySQL using VB.NET Datareader. The following are the code I used to read the column:
Public Function StartupData(ByVal strKeySet as String)
Dim test as string
Dim MyTinyText as stringTry
ObjComm = New OdbcCommand("SELECT SettingValue FROM pos_setting WHERE LocationCode='KK' AND SettingKey='ADD_BINLOG'", ObjConn)
ObjConn.Open()
ObjRead = ObjComm.ExecuteReader()
If ObjRead.Read Then
test = ObjRead.Item(0)
MessageBox.Show("This is " & test & "")
Else
MessageBox.Show("No value")
End If
ObjConn.Close()Catch ex As Exception
Finally
Objconn.Close
End TryAnd my database table as follow:
/*Column Information For - test.pos_setting*/
Field Type Collation Null Key Default Extra Privileges Comment
LocationCode varchar(10) latin1_swedish_ci NO PRI select,insert,update,references
SettingKey varchar(10) latin1_swedish_ci NO PRI select,insert,update,references
SettingValue tinytext latin1_swedish_ci YES (NULL) select,insert,update,referencesI'm wondering why its keep showing there is no data read inside the datareader? Actually there is a '0' inside the SettingValue for that row of data but I'm wondering why it doesn't read it? Anyone can give me a solution for this? Thanks for reading~!
-
Hello all,I am wondering anyone can guide me how to read tiny text column for MySQL using VB.NET Datareader. The following are the code I used to read the column:
Public Function StartupData(ByVal strKeySet as String)
Dim test as string
Dim MyTinyText as stringTry
ObjComm = New OdbcCommand("SELECT SettingValue FROM pos_setting WHERE LocationCode='KK' AND SettingKey='ADD_BINLOG'", ObjConn)
ObjConn.Open()
ObjRead = ObjComm.ExecuteReader()
If ObjRead.Read Then
test = ObjRead.Item(0)
MessageBox.Show("This is " & test & "")
Else
MessageBox.Show("No value")
End If
ObjConn.Close()Catch ex As Exception
Finally
Objconn.Close
End TryAnd my database table as follow:
/*Column Information For - test.pos_setting*/
Field Type Collation Null Key Default Extra Privileges Comment
LocationCode varchar(10) latin1_swedish_ci NO PRI select,insert,update,references
SettingKey varchar(10) latin1_swedish_ci NO PRI select,insert,update,references
SettingValue tinytext latin1_swedish_ci YES (NULL) select,insert,update,referencesI'm wondering why its keep showing there is no data read inside the datareader? Actually there is a '0' inside the SettingValue for that row of data but I'm wondering why it doesn't read it? Anyone can give me a solution for this? Thanks for reading~!