X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 34F7ED1B4EC for ; Fri, 17 Oct 2003 14:04:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46298-07 for ; Fri, 17 Oct 2003 11:04:09 -0300 (ADT) Received: from gk-us2.michelin.com (unknown [156.65.14.19]) by svr1.postgresql.org (Postfix) with ESMTP id 67C4AD1B547 for ; Fri, 17 Oct 2003 11:03:55 -0300 (ADT) Received: from ONCMH1.onc.michelin.com (unverified) by gk-us2.michelin.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Fri, 17 Oct 2003 09:53:27 -0400 Received: from oncmtap1.onc.michelin.com by oncmh1.onc.michelin.com with ESMTP for pgsql-odbc@postgresql.org; Fri, 17 Oct 2003 09:56:26 -0400 Received: from oncems01.onc.michelin.com ([156.65.125.150]) by oncmtap1.onc.michelin.com (Netscape Messaging Server 4.15) with ESMTP id HMWMU000.K3R for ; Fri, 17 Oct 2003 09:58:48 -0400 Received: from us.michelin.com (unverified) by oncems01.onc.michelin.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Fri, 17 Oct 2003 09:58:48 -0400 Message-Id: <3F8FF596.3942D34E@us.michelin.com> Date: Fri, 17 Oct 2003 09:58:46 -0400 From: "Greg Campbell" X-Mailer: Mozilla 4.77 [en]C-CCK-MCD (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Nigel Brookes Cc: pgsql-odbc@postgresql.org Subject: Re: Insert query References: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/57 X-Sequence-Number: 3370 I guess you are using RDO under VB5. My first suggestion is to "get thee to a newer interface." But the real problem lies in the SQL. Serial data types are auto-incrementing and do not need a value in the INSERT statement ergo: INSERT INTO users VALUES ('Nigel'); should work just fine -- or almost Secondly, you are trying to use POSITIONAL syntax on the insert, that is to say you have written INSERT INTO mytable VALUES (field1_value, field2_value, field3_value,..); This make success dependent on the order of your fields in the INSERT string being the same as the order of the fields in the database, so the order of fields in the database better not change. It is a better practice to use field name explicit syntax INSERT INTO mytable (field1_name, field2_name, field3_name,...) VALUES (field1_value, field2_value, field3_value,..); example INSERT INTO users (first_name, last_name) VALUES ('Nigel','Brookes'); Nigel Brookes wrote: > > Hi Folks, > > I'm very new to ODBC and am using VB 5.0. I have a table with a serial data > type that I'm trying to insert a record into using. > > INSERT INTO users VALUES (DEFAULT,'Nigel'); > > This works when i'm in linux. But when I try to execute it in VB I get an > error 'Too few parameters. Expected 1.'. Very strange. Have tried all 3 > odbc drivers. The VB code I use is as follows: > > Dim Backupdb As Database > '******opens access to PostgreSQL database *********************** > Connect = "ODBC;DSN=backupdb;DATABASE=backupdb;UID=test;PWD=test;" > Set Backupdb = OpenDatabase("backupdb", False, False, Connect) > '***************************************************************** > > Backupdb.Execute txtExecute.Text > > Any Ideas?? > > Regard > > Nigel > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings