No you are correct. If you are just filling in values and creating command
parameters then ADO.NET takes care of the issue. However if you are creating
dynamic SQL statements (creating the field lists, or entire where and order
by clauses) then you will need to be careful.
> Doesn't have to worry about injection attacks because Parameterized
> queries take parameters, and those parameters aren't executed as SQL
[quoted text clipped - 33 lines]
>>>
>>> Thanks for any thoughts!
Ye - 07 May 2005 06:02 GMT
If the parameters are known but optional, you can still use a stored
procedure and benefit from the plan caching. For example, if a user can
search by first name, last name, address, phone, or email where each one is
optional you can definitely use a stored procedure by checking if the
optional parameters are null. But I suspect J already knows about that.
If some of the parameters can have multiple values, I would package the
parameters in an xml string and pass it in as a text parameter to a stored
procedure. The stored procedure would use OpenXml to place those values into
a table and then do the search. More info can be found here:
http://www.sql-server-performance.com/jb_openxml.asp
Not sure if I'm addressing understood your problem correctly. Hope this helps.
Cheng Yuan Yap Ye
http://kuantanzai.blogspot.com
> No you are correct. If you are just filling in values and creating command
> parameters then ADO.NET takes care of the issue. However if you are creating
[quoted text clipped - 38 lines]
> >>>
> >>> Thanks for any thoughts!