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

Need help with Visual Basic 6 and PostgreSQL

From: Finn Lassen <dcio(at)AxiomInt(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Need help with Visual Basic 6 and PostgreSQL
Date: 2007-11-22 02:36:57
Message-ID: 4744EB49.6050305@AxiomInt.com (view raw or flat)
Thread:
Lists: pgsql-odbc
<!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&nbsp;&nbsp;&nbsp; &nbsp;AppVer: 6.0.97.82&nbsp;&nbsp;&nbsp; &nbsp;ModName: psqlodbc30a.dll<br>
ModVer: 8.2.4.0&nbsp;&nbsp;&nbsp; &nbsp;Offset: 00016edc<br>
----------------------------------------------------------------------------&nbsp;
<br>
&nbsp;&nbsp;&nbsp; Dim dbOut As ADODB.Connection<br>
&nbsp;&nbsp;&nbsp; Dim rsOut As ADODB.Recordset<br>
&nbsp;&nbsp;&nbsp; Set dbOut = New ADODB.Connection<br>
&nbsp;&nbsp;&nbsp; Set rsOut = New ADODB.Recordset<br>
<br>
&nbsp;&nbsp;&nbsp; With dbOut<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .ConnectionString = "Driver={PostgreSQL
ANSI};Server=localhost;Port=5432;Database=postgres;Uid=user;Pwd=secret;"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Open<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With rsOut<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rsOut.Open """Contact1""", dbOut, adOpenDynamic,
adLockOptimistic, adCmdTable<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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>.Update</b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Exit Loop code here<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loop<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Close<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Close<br>
&nbsp;&nbsp;&nbsp; End With<br>
&nbsp;&nbsp;&nbsp; Set dbOut = Nothing<br>
&nbsp;&nbsp;&nbsp; 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(at)AxiomInt(dot)com">dcio(at)AxiomInt(dot)com</a>
<a class="moz-txt-link-abbreviated" href="http://www.AxiomInt.com">www.AxiomInt.com</a>
</pre>
</body>
</html>



Attachment: unknown_filename
Description: text/html (5.0 KB)

Responses

pgsql-odbc by date

Next:From: Richard Broersma JrDate: 2007-11-22 03:17:36
Subject: Re: Need help with Visual Basic 6 and PostgreSQL
Previous:From: gunarthaDate: 2007-11-21 18:54:42
Subject: string function

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