Skip site navigation (1) Skip section navigation (2)

Problems with MFC AddNew

From: iklassen(at)phhpc(dot)com
To: pgsql-odbc(at)postgresql(dot)org
Subject: Problems with MFC AddNew
Date: 2007-01-23 17:18:48
Message-ID: (view raw or whole thread)
Lists: pgsql-odbc

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;
CProject project(&database);
project.m_project_id = 1;

I get an Access Violation on the Update().  The log file shows the
following error:

conn=01104290, query='SELECT "project_id"  , "ctid", "project_id" FROM
    [ fetched 0 rows ]

[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

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.



pgsql-odbc by date

Next:From: Feng ChenDate: 2007-01-24 19:16:42
Subject: Postgres Stored Procedure Call Function Return Type OID Caching Problem
Previous:From: Ludek FinstrleDate: 2007-01-23 14:56:06
Subject: Re: odbc configuration to localhost [locally]

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group