PgSqlCommandBuilder - How to exclude database name?

PgSqlCommandBuilder - How to exclude database name?

Postby 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
hmuscroft
 
Posts: 23
Joined: Tue 28 Nov 2006 10:07

Postby Alexey » Mon 11 Dec 2006 13:08

Try to set
Code: Select all
            cb.Quoted = true;
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby hmuscroft » Tue 12 Dec 2006 12:24

Yes that works - thanks. :D
hmuscroft
 
Posts: 23
Joined: Tue 28 Nov 2006 10:07

Postby Alexey » Tue 12 Dec 2006 13:13

You are welcome.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for PostgreSQL