help with using parameters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • beGentle-Learner

    #1

    help with using parameters

    I have a query which looks like this :"INSERT INTO demo (idperson,
    name)SELECT idperson,name FROM ptolemy_person WHERE idperson = @original"
    and I have declared a parameter in this way:
    OleDbCommand1.P arameters.Add(" @original", txtvalue.Text).

    the query is supposed to populate a table(demo) with records from another
    table(ptolemy_p erson) based on the id of the records which are typed in the
    textbox.

    when i run the progam i get this error: THe oledbparameter collection only
    accepts non-null oledbparameter type objects. not strings

    Can you please help
    thanx
    be_gentle learner


  • Kerry Moorman

    #2
    RE: help with using parameters

    beGentle-Learner,

    Depending on the particular database and version of ADO.Net, you might need
    to change the parameter placeholder to this:

    "INSERT INTO demo (idperson, name) SELECT idperson,name
    FROM ptolemy_person WHERE idperson = ?"

    At any rate, that is the first thing I would try.

    Kerry Moorman


    "beGentle-Learner" wrote:
    [color=blue]
    > I have a query which looks like this :"INSERT INTO demo (idperson,
    > name)SELECT idperson,name FROM ptolemy_person WHERE idperson = @original"
    > and I have declared a parameter in this way:
    > OleDbCommand1.P arameters.Add(" @original", txtvalue.Text).
    >
    > the query is supposed to populate a table(demo) with records from another
    > table(ptolemy_p erson) based on the id of the records which are typed in the
    > textbox.
    >
    > when i run the progam i get this error: THe oledbparameter collection only
    > accepts non-null oledbparameter type objects. not strings
    >
    > Can you please help
    > thanx
    > be_gentle learner
    >
    >[/color]

    Comment

    Working...