Hi,
"SubstandardSnowman" <SubstandardSnowman@discussions.microsoft.com> wrote in
message news:9540B157-2929-4908-A175-0EA2BCF2C227@microsoft.com...
[quoted text, click to view] > I'm building a dynamic command like this.
> "SELECT * FROM Clients WHERE FirstName LIKE @FirstName"
> and I set the paramater like this.
>
> sqlCMD.Paramaters.Add("@FirstName", "%" & fnameVariable & "%")
>
> The reason I'm doing this is I need it to search the whole field to see if
it contains any of the text in "fnameVariable". My question is am I going to
run into any problems if the user enters in any special characters for the
"fnameVariable" (i.e. %, *, etc)?
[quoted text, click to view] > I was under the impression that using the SqlCommand with paramaters was
supposed to take care of that sort of stuff.
Parametrised query protects you from injection attack and takes care of
quoting.
What problems have you in mind?
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com