database not returning values

Jeffo

Member
Joined
Apr 26, 2005
Messages
9
Programming Experience
1-3
Im having a problem where a client sends an ipaddress to be checked for in the database, it should either return null for the values selected or return the ipaddress and latency for the ipaddress sent.
But it only returns the values that the client sends and seems to not check the database.
Here is the code that is suppsoed to check the database and return the valeus stored in it:



Code: sSQL = "SELECT IPAddress, Latency FROM twmData WHERE IPAddress = ('" & textarray(0) & "')"
Dim cmd As New OleDb.OleDbCommand(sSQL, conNect)
Dim sqlrep As Integer
Dim dr As OleDb.OleDbDataReader
sqlrep = cmd.ExecuteNonQuery()
Dim myCommand As New OleDb.OleDbCommand(sSQL, conNect)
Dim test2
Dim test4
dr = myCommand.ExecuteReader
While dr.Read()
WriteLine(dr(0))
WriteLine(dr(1))
' writing to console
End While
 
First of all, get rid of that ExecuteNonQuery bit. You ARE performing a query so that is not appropriate.

Secondly, your code does not open the connection anywhere, which you will need to do to call ExecuteReader.

Thirdly, what are you using as the IPAdress and what values are being written to the console?
 
Back
Top