error in parameterized query

  • i m trying to execute query with server 2000

    query is: select * from employee where salary = ?

    but the above query gives error, which is:

    [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error

    if anybody know the answer of this query, then kindly do reply

  • With sqlserver it doesn't work as with msaccess !

    declare @myvar int

    set @myvar = 15

    select ... from myobject where thecolumn=@myvar

    With odbc this would mean you define a commandobject,

    type=storedprocedure

    commandtext='select ... from myobject where thecolumn=?'

    cmdobj.parameters.add (@myvar, dbinteger,,15)

    the syntax is not exact, but I hope you get back on track ...

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply