Re: ExecuteNonQuery Wierdness



Hello bug0926@xxxxxxxxx,

The last part of your code is a lil screwy. Try this:

Public Sub Read()

Dim tSQL As String = "SELECT timestamp, sensor, eventId, eventValue FROM Log"
Dim tConnection As SqlConnection = New SqlConnection
Dim tCommand As SqlCommand = New SqlCommand
Dim tReader As SqlDataReader = Nothing

With tCommand
.Connection = tConnection
.COmmandType = CommandType.Text
.CommandText = tSQL
End With
tConnection.Open
tReader = tCommand.ExecuteReader
If tReader.HasRows Then
While tReader.Read
Debug.Print(String.Format("{0}, {1}, {2}, {3}", tReader("timestamp"), tReader("sensor"), tReader("eventId"), tReader("eventValue")))
End While
End If
tConnection.Close

End Sub


Public Sub read()
Dim sql As String
Dim dbReader As SqlClient.SqlDataReader
sql = "select timestamp, sensor, eventId, eventValue from Log"
dbCommand = dbConn.CreateCommand()
dbCommand.CommandText = sql
dbReader = dbCommand.ExecuteReader(sql)

While dbReader.HasRows
Debug.Print(dbReader(0))
Debug.Print(dbReader(1))
End While
dbReader.Close()
End Sub


.



Relevant Pages

  • Re: Mini Review: The new iMac G5
    ... >turn off your Mac during the daytime. ... The sensor won't dim. ...
    (uk.comp.sys.mac)
  • Re: Mini Review: The new iMac G5
    ... >> turn off your Mac during the daytime. ... The sensor won't dim. ... That's even worser;-) ...
    (uk.comp.sys.mac)
  • Re: Nikon D50 or D70
    ... The viewing system is incomparably better than the execrable, dim D50/70. ... The 10mp sensor, particularly for raw shooting, will make you feel like ...
    (alt.photography)
  • Re: D70 in todays marketplace?
    ... The only drawback of the D70 is that the viewfinder is a bit small and dim ... Has high-ISO sensor performance improved at all in the last 4 years? ... faster lenses of SLRs will surely help, but high ISO is important too. ...
    (rec.photo.digital)