PgSqlCommandBuilder - How to exclude database name?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
hmuscroft
Posts: 23
Joined: Tue 28 Nov 2006 10:07

PgSqlCommandBuilder - How to exclude database name?

Post by hmuscroft » Mon 11 Dec 2006 11:15

Hi,

I have a database called "Sample Database". MyConnectionStr is as follows :-

Code: Select all

User Id=user;Password=passwd;Host=localhost;Port=5432;Database="Sample Database";Unicode=True;Schema=public;
There is a simple table called "layout" in the "public" schema defined as follows :-

Code: Select all

CREATE TABLE public.layout (
  id int8 NOT NULL,
  section varchar(30) NOT NULL,
  name varchar(120) NOT NULL,
  staff_id int8,
  data bytea,
  CONSTRAINT layout_pkey PRIMARY KEY(id)
)
WITHOUT OIDS;
If I do this :-

Code: Select all

PgSqlDataAdapter adap = new PgSqlDataAdapter("select * from layout", MyConnectionStr);
PgSqlCommandBuilder cb = new PgSqlCommandBuilder(adap);
Console.WriteLine(cb.GetUpdateCommand().CommandText);
The output is :-

UPDATE Sample Database.public.layout SET updatedby = :p1

Obviously that fails!!! How do I get PgSqlCommandBuilder to exclude the database name?

Thanks,

Hedley

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 11 Dec 2006 13:08

Try to set

Code: Select all

            cb.Quoted = true;

hmuscroft
Posts: 23
Joined: Tue 28 Nov 2006 10:07

Post by hmuscroft » Tue 12 Dec 2006 12:24

Yes that works - thanks. :D

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 12 Dec 2006 13:13

You are welcome.

Post Reply