Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B1FA19FB2F7 for ; Tue, 23 Jan 2007 13:49:28 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 25762-06 for ; Tue, 23 Jan 2007 13:49:24 -0400 (AST) X-Greylist: delayed 00:29:55.607997 by SQLgrey-1.7.4 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 7F4349FB5DF for ; Tue, 23 Jan 2007 13:49:25 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from nike.site5.com (nike.site5.com [216.118.97.212]) by svr4.postgresql.org (Postfix) with ESMTP id A78B95AF9E1 for ; Tue, 23 Jan 2007 17:19:29 +0000 (GMT) Received: from phhpccom by nike.site5.com with local (Exim 4.63) (envelope-from ) id 1H9PIG-00025G-LJ for pgsql-odbc@postgresql.org; Tue, 23 Jan 2007 12:18:48 -0500 Received: from 68.145.165.239 ([68.145.165.239]) (SquirrelMail authenticated user iklassen@phhpc.com) by phhpc.com with HTTP; Tue, 23 Jan 2007 10:18:48 -0700 (MST) Message-ID: <63255.68.145.165.239.1169572728.squirrel@phhpc.com> Date: Tue, 23 Jan 2007 10:18:48 -0700 (MST) Subject: Problems with MFC AddNew From: iklassen@phhpc.com To: pgsql-odbc@postgresql.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - nike.site5.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [32085 32002] / [47 12] X-AntiAbuse: Sender Address Domain - phhpc.com X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/3rdparty/squirrelmail/src/compose.php X-Source-Dir: :/base/3rdparty/squirrelmail/src X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.962 tagged_above=0 required=5 tests=BAYES_50, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200701/53 X-Sequence-Number: 8592 Hello, I'm having some difficulty with adding new records using the ODBC driver with MFC. This is only occurring is certain situations... I created a simple table: CREATE TABLE project (project_id INT PRIMARY KEY); Using Visual Studio C++ I created a CRecordset class (CProject) to exchange data with the project table. I then execute the following code: CDatabase database; database.OpenEx(_T("DSN=PostgreSQL30")); CProject project(&database); project.Open(); project.AddNew(); project.m_project_id = 1; project.Update(); I get an Access Violation on the Update(). The log file shows the following error: psqlodbc_3100.log: conn=01104290, query='SELECT "project_id" , "ctid", "project_id" FROM "public"."project"' [ fetched 0 rows ] mylog_3100.log: [1800-4.186]extend_putdata_info: entering ... self=016C5EC4, parameters_allocated=0, num_params=1 [1800-4.191]extend_putdata_info: unable to create 1 new pdata from 0 old pdata Now I've been able to get the Update() to work in the following situations: - remove the primary key: CREATE TABLE project (project_id INT); - change the int to bigint: CREATE TABLE project (project_id BIGINT PRIMARY KEY); - make sure at least one record exists in the table: CREATE TABLE project (project_id INT PRIMARY KEY); INSERT INTO project (project_id) VALUES (2); So what's going on? I would like to use int, but if I have to I can switch to bigint. Thanks for your help. Ian