value of type 'string' cannot be converted to 'Devart.data.postgresql.PgSqlParameter'

Posted by hector on Stack Overflow See other posts from Stack Overflow or by hector
Published on 2014-06-06T09:14:21Z Indexed on 2014/06/06 9:25 UTC
Read the original article Hit count: 241

The following is my PostgreSQL table structure and the vb.net code to insert into the tables.Using Devart's Component For PostgreSQL Connect

table gtab83

    CREATE TABLE gtab83
(
  orderid integer NOT NULL DEFAULT nextval('seq_gtab83_id'::regclass),
  acid integer,
  slno integer,
  orderdte date
)

table gtab84

    CREATE TABLE gtab84
(
  orderdetid integer DEFAULT nextval('seq_gtab84_id'::regclass),
  productid integer,
  qty integer,
  orderid integer
)

Code to insert into the above tables is below

        '1.)INSERT INTO gtab83(orderid,acid, slno, orderdte) VALUES (?, ?, ?);
        '2.)INSERT INTO gtab84(orderdetid,productid, qty, orderid)  VALUES (?, ?, ?);

        Try
            Dim cmd As PgSqlCommand = New PgSqlCommand("", Myconnstr)
            cmd.CommandText = _
            "INSERT INTO GTAB83(ACID,SLNO,ORDERDTE)" & _
            "VALUES " & _
            "(@acid,@slno,@orderdte);"
            Dim paramAcid As PgSqlParameter = New PgSqlParameter("@acid", PgSqlType.Int, 0)
            Dim paramSlno As PgSqlParameter = New PgSqlParameter("@slno", PgSqlType.Int, 0)
            Dim paramOrderdte As PgSqlParameter = New PgSqlParameter("@orderdte", PgSqlType.Date, 0)
            paramAcid = cboCust.SelectedValue
            paramSlno = txtOrderNO.Text #ERROR#
            paramOrderdte = (txtDate.Text, "yyyy-MM-dd") #ERROR#
        Catch ex As Exception

        End Try

ERROR :

value of type 'string' cannot be converted to 'Devart.data.postgresql.PgSqlParameter'

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about postgresql