Need help with Visual Basic 6 and PostgreSQL
От | Finn Lassen |
---|---|
Тема | Need help with Visual Basic 6 and PostgreSQL |
Дата | |
Msg-id | 4744EB49.6050305@AxiomInt.com обсуждение исходный текст |
Ответы |
Re: Need help with Visual Basic 6 and PostgreSQL
(Richard Broersma Jr <rabroersma@yahoo.com>)
Re: Need help with Visual Basic 6 and PostgreSQL (Paul Lambert <paul.lambert@reynolds.com.au>) |
Список | pgsql-odbc |
I am very new to ADODB, ODBC and SQL databases.<br /><br /> When I run the following which I wrote to populate tables (withdata from a Borland V database) , the Visual Basic Developer Interface crashes with the following error signature (WindowsXP):<br /> AppName: vb6.exe AppVer: 6.0.97.82 ModName: psqlodbc30a.dll<br /> ModVer: 8.2.4.0 Offset:00016edc<br /> ---------------------------------------------------------------------------- <br /> Dim dbOutAs ADODB.Connection<br /> Dim rsOut As ADODB.Recordset<br /> Set dbOut = New ADODB.Connection<br /> SetrsOut = 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 hadto 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 iswhen 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 /> Anysuggestions 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>
В списке pgsql-odbc по дате отправления: