Trying to do a OleDbCommand to find a row in an excel sheet. Each row has a low number and a high number in different cells. No rows have overlapping numbers. I am not getting any results nor errors. Though I know I am a row's range. 205221 is the sheet name. StartSerial and StopSerial are column headers. Do I need to use the column letter instead?
***Edit: Sample data:
Job | Descript | StartSerial | StopSerial |
---|---|---|---|
55555 | Job1 | 44334 | 44897 |
55556 | Job2 | 44898 | 45001 |
55557 | Job3 | 45002 | 46001 |
comm = New OleDbCommand("SELECT * from [205221$] WHERE (StartSerial) <= " & serial & " AND (StopSerial) >= " & serial, conn)
Try
dr = comm.ExecuteReader
Catch ex As Exception
MsgBox(ex)
End Try
While dr.Read
Dim jobNum = dr("Job").ToString
Dim jobName = dr("Descript").ToString
TextBox1.AppendText(jobNum & " " & jobName)
End While