From: Finn Lassen <dcio@AxiomInt.com>
To: pgsql-odbc@postgresql.org
Subject: Need help with Visual Basic 6 and PostgreSQL
Date: Wed, 21 Nov 2007 21:36:57 -0500
Message-ID: <4744EB49.6050305@AxiomInt.com> (raw)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
I am very new to ADODB, ODBC and SQL databases.<br>
<br>
When I run the following which I wrote to populate tables (with data
from a Borland V database) , the Visual Basic Developer Interface
crashes with the following error signature (Windows XP):<br>
AppName: vb6.exe AppVer: 6.0.97.82 ModName: psqlodbc30a.dll<br>
ModVer: 8.2.4.0 Offset: 00016edc<br>
----------------------------------------------------------------------------
<br>
Dim dbOut As ADODB.Connection<br>
Dim rsOut As ADODB.Recordset<br>
Set dbOut = New ADODB.Connection<br>
Set rsOut = New ADODB.Recordset<br>
<br>
With dbOut<br>
.ConnectionString = "Driver={PostgreSQL
ANSI};Server=localhost;Port=5432;Database=postgres;Uid=user;Pwd=secret;"<br>
.Open<br>
With rsOut<br>
rsOut.Open """Contact1""", dbOut, adOpenDynamic,
adLockOptimistic, adCmdTable<br>
Do<br>
.AddNew<br>
For Each fld In .Fields<br>
Debug.Print fld.name, fld.Type<br>
Select Case fld.Type<br>
Case 3 'integer (oid)<br>
Case 200, 202 'Memo -- Text (ANSI: 200,
Unicode: 202)<br>
fld.value = "Memo type text"<br>
Case 133 'Date<br>
fld.value = Date<br>
Case Else<br>
fld.value =
"FixedLengthStrings" <br>
End Select<br>
Next fld<br>
<b>.Update</b><br>
'Exit Loop code here<br>
Loop<br>
.Close<br>
End With<br>
.Close<br>
End With<br>
Set dbOut = Nothing<br>
Set rsOut = Nothing<br>
--------------------------------------------------------------------------------------------------------<br>
Note: I had to add a "oid" column to the table or the rsOut.Open would
fail with "ERROR: column "oid" does not exist;".<br>
<br>
It now crashes at the .Update statement.<br>
Previously it managed to add 2 rows to the table.<br>
Another oddity is when using the VB Visual Data Manager add-in to view
the database it will not list the Indexes for the Contact1 table.<br>
It will list the Indexes for the Contact2 table which is not populated
nor been worked with.<br>
<br>
Any suggestions on how proceed?<br>
Do I have to configure the PostgreSQL ANSI driver somehow? If so, how?<br>
<br>
Finn<br>
<pre class="moz-signature" cols="72">--
Finn Lassen
Deputy CIO
Axiom
1805 Drew Street
Clearwater, Florida 33765
727-442-7774 voice
727-442-8344 fax
<a class="moz-txt-link-abbreviated" href="mailto:dcio@AxiomInt.com">dcio@AxiomInt.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.AxiomInt.com">www.AxiomInt.com</a;
</pre>
</body>
</html>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: dcio@AxiomInt.com
Subject: Re: Need help with Visual Basic 6 and PostgreSQL
In-Reply-To: <4744EB49.6050305@AxiomInt.com>
References: <4744EB49.6050305@AxiomInt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox