paramertised select query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • steve

    #1

    paramertised select query

    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


  • Kerry Moorman

    #2
    RE: paramertised select query

    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


    "steve" wrote:
    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
    >
    >
    >

    Comment

    • steve

      #3
      Re: paramertised select query

      Hi Kerry

      Thanks so much

      Worked a treat

      Regards
      Steve


      "Kerry Moorman" <KerryMoorman@d iscussions.micr osoft.comwrote in message
      news:79426A2A-FD23-4917-B1A3-A669C258ECAD@mi crosoft.com...
      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
      >
      >
      "steve" wrote:
      >
      >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
      >>
      >>
      >>

      Comment

      Working...