The following code is looking for the phone number of contacts in a database when the column "hoohoo" = 15. However it doesnt keep to this condition, but displays all of the numbers. Am i missing a line that tells it to keep to the condition???
Code:Dim SQL As String = "SELECT *, Phone FROM TblContacts WHERE Hoodoo=15" Dim myOleDbCommand As New OleDb.OleDbCommand(SQL, con) con.Open() Dim count As Int32 = Convert.ToInt32(myOleDbCommand.ExecuteScalar()) Using myDataReader As OleDb.OleDbDataReader = myOleDbCommand.ExecuteReader() If myDataReader.Read() Then While myDataReader.Read() ' txtPhone.Text = numbers.Text += myDataReader.Item("Phone").ToString + vbCrLf notfound = 0 End While


Reply With Quote

