Results 1 to 3 of 3

Thread: conigure DataAdapter

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    conigure DataAdapter

    Hi All.
    I try configure DataAdapter in VB2005:
    Code:
    SELECT CompName, Name, CustomerID
    FROM Customer
    WHERE CompName LIKE ?
    and got an error: Select statement problem near ?.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: conigure DataAdapter

    it looks like improper SQL syntax...

    usually its something like

    SELECT CompName, Name, CustomerID
    FROM Customer
    WHERE CompName LIKE '%PC%'

    that would find any records where CompName has PC in it

    just using a ? doesn't tell the SQL what the CompName is suppsed to be like to match against.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: conigure DataAdapter

    What type of DataAdapter? If it's an OleDbDataAdapter then you can use unnamed parameters like that. If it's an SqlDataAdapter then you must use named parameters, e.g.
    Code:
    SELECT CompName, Name, CustomerID FROM Customer WHERE CompName LIKE @CompName
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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