|
I am very new to ADODB, ODBC and SQL databases. 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): AppName: vb6.exe AppVer: 6.0.97.82 ModName: psqlodbc30a.dll ModVer: 8.2.4.0 Offset: 00016edc ---------------------------------------------------------------------------- Dim dbOut As ADODB.Connection Dim rsOut As ADODB.Recordset Set dbOut = New ADODB.Connection Set rsOut = New ADODB.Recordset With dbOut .ConnectionString = "Driver={PostgreSQL ANSI};Server=localhost;Port=5432;Database=postgres;Uid=user;Pwd=secret;" .Open With rsOut rsOut.Open """Contact1""", dbOut, adOpenDynamic, adLockOptimistic, adCmdTable Do .AddNew For Each fld In .Fields Debug.Print fld.name, fld.Type Select Case fld.Type Case 3 'integer (oid) Case 200, 202 'Memo -- Text (ANSI: 200, Unicode: 202) fld.value = "Memo type text" Case 133 'Date fld.value = Date Case Else fld.value = "FixedLengthStrings" End Select Next fld .Update 'Exit Loop code here Loop .Close End With .Close End With Set dbOut = Nothing Set rsOut = Nothing -------------------------------------------------------------------------------------------------------- Note: I had to add a "oid" column to the table or the rsOut.Open would fail with "ERROR: column "oid" does not exist;". It now crashes at the .Update statement. Previously it managed to add 2 rows to the table. 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. It will list the Indexes for the Contact2 table which is not populated nor been worked with. Any suggestions on how proceed? Do I have to configure the PostgreSQL ANSI driver somehow? If so, how? Finn -- Finn Lassen Deputy CIO Axiom 1805 Drew Street Clearwater, Florida 33765 727-442-7774 voice 727-442-8344 fax dcio(at)AxiomInt(dot)com www.AxiomInt.com |