Hi ,
I have this problem, where I want the query to find slimier results,
Like '%BandName%'
for a static query it's easy, but when I use a string from a textBox I am not sure what should be the syntax.

public static DataRow SearchByBandName(string bandToFind)
    {
        return DbUtils.SelectDataRow("SELECT  * from  Bands  WHERE BandName Like @BandName",

Any clue?

Thanks,
Mot.

Recommended Answers

All 2 Replies

You have to post complete code so we can examine.

Now, I am guessing.

public static DataRow SearchByBandName(string bandToFind)
    {
        return DbUtils.SelectDataRow("SELECT  * from  Bands  WHERE BandName Like '%" + bandToFind + "%'");
  }

Thanks, it works great,
(and super fast reply might I add:)

if I would want to find also something like:
'band__Find' , how is it possible?


Thanks in advance,
Mot.

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.