0

I am trying to insert data into a postgresql table in visual studio windows forms table adapter using this query;

    INSERT INTO PUBLIC .cashaccount
VALUES (:cashmemo, :cashcredit, :cashdebit)

I am using the ':' because I am aware the '@' operator does not work in postgresql but I am still getting a syntax error. I have googled this issue and I am yet to find a postgresql insert command with variables. Does anyone have an idea on how to make the above statement work?

Robert Omete
  • 64
  • 1
  • 10

1 Answers1

0

I believe the syntax error your are getting is due to the space in your table name as pointed below

INSERT INTO PUBLIC .cashaccount
                  ^----Here
VALUES (:cashmemo, :cashcredit, :cashdebit)

Also, read through Npgsql(.NET Postgresql provider) for more information with lots of examples.

Rahul
  • 76,197
  • 13
  • 71
  • 125
  • The error is around the colon in front of the value 'syntax error at or near ":"'.Have checked other errors .Remember I am writing the query in the TableAdapter which works if I substitute raw values like 'school',2000,3000 in place of :cashmemo,:cashcredit,:cashdebit respectively. – Robert Omete Jun 01 '15 at 21:36