![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I don't know if this is a bug or poor coding on my part, but when I use the .Read() function, the value of it changes and it jumps past my If box. When I ran a debug on the code after the execution of .ExecuteReader() there is a value in MyReader("lastchange"), but when it runs the test statement, MyReader advances and the test fails. Suggestions? 'This is the code that I am using. Dim MyConString As String Dim MySQLString As String MyConString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=s01; DATABASE=time-trax; UID=common; OPTION=3" MySQLString = "SELECT MAX(action_time) as lastchange FROM data WHERE employee_name = " & intAgentID Dim MyConnection As New OdbcConnection(MyConString) Dim MyCommand As New OdbcCommand(MySQLString, MyConnection) MyConnection.Open() Dim MyReader As OdbcDataReader MyReader = MyCommand.ExecuteReader() If MyReader.Read() Then GetLastActionDateTime = MyReader("lastchange") End If MyReader.Close() MyConnection.Close() Extra Info: Environment - Visual Basic.NET SQL Server - MySQL Data Connection - ODBC.NET |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |