locked
@Param for Access Databass RRS feed

  • Question

  • User1406963893 posted

    Hello All,

    I have DataSet And add access database and I want to selcet from tabel by @Param

    This the code

    SELECT        tblname.name, tblname.office, tblname.fax, tblname.another, tblcat.cat_name
    FROM            (tblname INNER JOIN
                             tblcat ON tblname.cat_id = tblcat.cat_id)
    WHERE        (tblname.name =  @Param)
    
    
    But show Error with "@Param"
    Monday, March 12, 2012 4:06 PM

Answers

  • User560403387 posted

    OledbCommand parameters only take ? style parameters. Replace your @Param by ?, and pass in your parameters in the right order.

    Menno

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2012 4:41 PM

All replies

  • User560403387 posted

    OledbCommand parameters only take ? style parameters. Replace your @Param by ?, and pass in your parameters in the right order.

    Menno

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2012 4:41 PM
  • User1406963893 posted

    OledbCommand parameters only take ? style parameters. Replace your @Param by ?, and pass in your parameters in the right order.

    Menno

    Thank you it's work :)

    Monday, March 12, 2012 4:56 PM
  • User-1199946673 posted

    OledbCommand parameters only take ? style parameters.

    Although this is what MSDN says, but when you test this you'll notice that named parameters are supported also... The only thing is that the name of the parameter doesn't need to be the same as the name of the parameter in the parametercollection, The parameters must be added in the same order they (first) appear in the command....

    Monday, March 12, 2012 5:49 PM