Martin310 0 Newbie Poster

Hi guys,

I've got a datagridview linked to an access database with a seach function. It's working well, but with one problem. It only locates displays the row(s) when the complete User Name is written. It would be much better if I could get the search to locate any rows where the User Name contains the text box string rather that when it equals it.

At the moment I am using:

Command.CommandText = "SELECT * FROM Users WHERE [User ID] = '" + txtSearchID.Text + "'";

I assumed it would be a case of adding a couple of * in, I've tried multiple variations but to no avail.

I'm sure theres a simple answer, just can't quite figure it out.

Any help greatly appreciated

Martin

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.