Also on the other use of it I think this may be closer to what you are trying to do:
VB Code:
Dim cmd As New OdbcCommand("SELECT Count(*) FROM cnci.txt WHERE PARCEL = " & TextBox2.Text, cnn) Dim result As Integer = cmd.ExecuteScalar MsgBox("Record(s) found " & result) cnn.Close()
Although since you already have all the data in a dataset its about 4 times faster to filter the dataset instead of running a new query.
VB Code:
Dim result() as Datarow=cityds.Tables(0).Select("PARCEL = " & TextBox2.Text, cnn) MsgBox("Record(s) found " & result.Length)
Running a new query took .4 of a second but running a filter on the dataset took .14 of a second. Which I also left the connection open from filling the dataset and normally you'd have to reopen it which will take longer, but that is not needed with the filter.




Reply With Quote