Hey all,
I am having a little trouble with my sql and VB.net I think
There it is I want to select records from a customer table which is like what the user types in (So they don't have to be exact matches. The statment runs but I don't think it is running correctly I stops after the first record which is the exact macth the the name I type in.
Here Is the code I am using. I just put James in instead of the text box value.
LastCus = "Select * from tblCustomer where ((Cus_Name Like 'James'));"
connetionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source = KellihersLawnmowers.accdb"
cnn = New OleDbConnection(connetionString)
cnn.Open()
cmd = New OleDbCommand(LastCus, cnn)
reader = cmd.ExecuteReader()
While reader.Read()
CustomerID = reader.Item(0)
FoundName = reader.Item(1)
foundNumber = reader.Item(2)
End While
reader.Close()
cmd.Dispose()
cnn.Close()
Catch myException As Exception
Finally
reader.Close()
cmd.Dispose()
The Codes runs find but only ever returns the exacty match.
Any Ideas?
Thanks
James