paramertised select query

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

Hi All

A lot of comments in replies to my posts in these newsgroups encourage me to
use parametised queries to protect against injection attacks

How can I return a datatable from a function by passing the function a
sqlclient command object

The command object only has executenonquery method or executereader and I
need a datatable with the result set

I am using vb.net 2005 and sql server express 2005 in a windows form
application

Regards
Steve
 
Steve,

You could assign the command object to a dataadapter's SelectCommand
property, call the dataadapter's Fill method, sending it a datatable to be
filled, and return the filled datatable.

Kerry Moorman
 
Back
Top