Home All Groups Group Topic Archive Search About

help with using parameters

Author
15 Jun 2006 8:54 AM
beGentle-Learner
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.Parameters.Add("@original", txtvalue.Text).

the query is supposed to populate a table(demo) with records from another
table(ptolemy_person) 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

Author
15 Jun 2006 2:22 PM
Kerry Moorman
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


Show quoteHide quote
"beGentle-Learner" wrote:

> 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.Parameters.Add("@original", txtvalue.Text).
>
> the query is supposed to populate a table(demo) with records from another
> table(ptolemy_person) 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
>           
>