Results 1 to 35 of 35

Thread: [RESOLVED] Maybe incorrect syntax for select statement SQL

Threaded View

  1. #22
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: Maybe incorrect syntax for select statement SQL

    I ask about sqlcommand parameters before, and this time about how to add parameters to sqldataadapter
    A sql adapter is based on a sql select command. That sql statement you're passing in when you create the adapter is being used to create the command behind the scenes. So you've basically got a couple of choices:-
    1. You can create the adapter as you are but pass in a select statement containg @parm rather than string concatenation. Then you can ad parameter to the underlying commance by using Adapter.SelectCommand.Parameters.AddWithValue (or similar)
    2. You can create the adapter without passing in a select statement, create the sql command explicitely complete with parameters (as you've done previously in this thread) and then set it as the SelectCommand of the adapter.

    Basically, your adapter has a command, that command has parameters. Does that clarify it?
    Last edited by FunkyDexter; Jul 13th, 2015 at 08:57 AM.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width