cant insert into a post gre sql table...Can u please help in fixing this

Started by kona ajayabout 12 years ago4 messagesbugs
Jump to latest
#1kona ajay
konaajay@gmail.com

Please help me in fixing this . Thanking you

Attachments:

untitled.bmpimage/bmp; name=untitled.bmpDownload+0-1
#2kona ajay
konaajay@gmail.com
In reply to: kona ajay (#1)
Fwd: cant insert into a post gre sql table...Can u please help in fixing this

here i am sending my actual code

string employee = "insert into VSP_Employee values ('" + txtEmpid.Text +
"','" + txtEmpname.Text + "','" + txtEmailid.Text + "','" + txtphnum.Text +
"','" + txtDOB.Text + "','" +txtDOJ.Text + "','" + txtNOD.Text + "','" +
txtSalary.Text + "','" + txtLeavestaken.Text + "','" +
txtLeavesBalance.Text + "','" + txtPlannedleaves.Text+"')";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(employee,
conn);
cmd = new NpgsqlCommand(employee, conn);
da = new NpgsqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds, "VSP_Employee");

Please help me in fixing this . Thanking you

Attachments:

untitled.bmpimage/bmp; name=untitled.bmpDownload+0-1
#3John R Pierce
pierce@hogranch.com
In reply to: kona ajay (#2)
Re: Fwd: cant insert into a post gre sql table...Can u please help in fixing this

On 4/14/2014 12:51 AM, kona ajay wrote:

Please help me in fixing this . Thanking you

the error seems pretty explicit. "relation vsp_employee does not exist"

I fail to see how this is a postgres bug.

btw, thats a terrible way of programming SQL queries. a all someone
would have to do would be to enter

'); drop table vsp_employee;

as an employee name and you'd be in a world of hurt. you should instead
pass in the data values as arguments to a parametrized query. as I
don't do .NET stuff, you'll need to look up how to do that yourself.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#4David G. Johnston
david.g.johnston@gmail.com
In reply to: kona ajay (#2)
Re: Fwd: cant insert into a post gre sql table...Can u please help in fixing this

kona ajay wrote

"insert into VSP_Employee values [...]

If you managed to create the table in a case-sensitive manner you will need
to refer to it in the same way - namely with double-quotes surrounding the
identifier. Otherwise all identifiers are case-folded to lower case.

"VSP_Employee" -> same
VSP_Employee -> vsp_employee

My other guess is you think you are hitting a database with the table but in
reality you are connecting to a different database where the table does not
exist.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/cant-insert-into-a-post-gre-sql-table-Can-u-please-help-in-fixing-this-tp5799954p5799972.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs