Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2AB11632746 for ; Sat, 10 Oct 2009 12:37:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90083-05 for ; Sat, 10 Oct 2009 15:37:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 209FE6326A9 for ; Sat, 10 Oct 2009 12:37:30 -0300 (ADT) Received: from [71.94.250.238] (unknown [71.94.250.238]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 66FFB34803A; Sat, 10 Oct 2009 08:37:19 -0700 (PDT) Subject: Re: Problem with C# TableAdapter From: "Joshua D. Drake" Reply-To: jd@commandprompt.com To: Klaus Ummenhofer Cc: pgsql-odbc@postgresql.org In-Reply-To: <200910101433.n9AEXEHN021287@post.webmailer.de> References: <200910101433.n9AEXEHN021287@post.webmailer.de> Content-Type: text/plain Organization: Command Prompt, Inc. Date: Sat, 10 Oct 2009 08:37:23 -0700 Message-Id: <1255189043.31694.1.camel@jd-desktop.unknown.charter.com> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/17 X-Sequence-Number: 10042 On Sat, 2009-10-10 at 16:33 +0200, Klaus Ummenhofer wrote: > Hello community, > > I try to access a PostgreSql database with C# and have some problems creating a TableAdapter. This doesn't answer your question, but why are you not using the .Net driver? Joshua D. Drake > > The problem is that a new TableAdapter does only create the SELECT command but not the commands for UPDATE, INSERT and DELETE. I am using the ODBC driver PSQLODBC30A.DLL 8.04.01.00, PostgreSql 8.4 and VS2005. > > I found some information affecting my problem which are related to primary keys. So far I am aware of needing a primary key in order to generate these commands. Please could someone inspect the CREATE scripts below which are not working properly and let me know, how I should change them. > > What else could I do in order to use the database via a TableAdapter object? > > Thank you. > > Klaus > > CREATE TABLE films ( > code char(5) CONSTRAINT firstkey PRIMARY KEY, > title varchar(40) NOT NULL, > did integer NOT NULL, > date_prod date, > kind varchar(10), > len interval hour to minute > ); > > > CREATE TABLE script > ( > id serial NOT NULL, > "name" character varying(10) NOT NULL, > script_data text, > CONSTRAINT script_pk PRIMARY KEY (id) > ) > WITH ( > OIDS=FALSE > ); > ALTER TABLE script OWNER TO postgres; > -- PostgreSQL.org Major Contributor Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564 Consulting, Training, Support, Custom Development, Engineering If the world pushes look it in the eye and GRR. Then push back harder. - Salamander