From: | "Thomas Holschen" <Thomas(dot)Holschen(at)hela-food(dot)de> |
---|---|
To: | "Ludek Finstrle" <luf(at)pzkagis(dot)cz>, <dpage(at)vale-housing(dot)co(dot)uk> |
Cc: | <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Antw: Re: VBA 6 crashes with WIN2K, Postgres 8.1, why? which dll ?? |
Date: | 2006-01-06 11:19:45 |
Message-ID: | 43BE6061.DB7B.0033.1@helafood.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
--
_____________________________________________
Hela Gewürzwerk Hermann Laue GmbH & Co.KG
EDV
Thomas Holschen
Beimoorweg 11
22926 Ahrensburg
Tel. : +49 4102/496-381
http://www.hela-food.de
_____________________________________________
>>> "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk> schrieb am Freitag, 6.
Januar 2006 um
10:29 in Nachricht
<E7F85A1B5FF8D44C8A1AF6885BC9A0E4E7EDEA(at)ratbert(dot)vale-housing(dot)co(dot)uk>:
>
>> -----Original Message-----
>> From: Ludek Finstrle [mailto:luf(at)pzkagis(dot)cz]
>> Sent: 06 January 2006 08:39
>> To: Dave Page
>> Cc: pgsql-odbc(at)postgresql(dot)org
>> Subject: Re: [ODBC] VBA 6 crashes with WIN2K, Postgres 8.1,
>> why ? which dll ??
>>
>> Why it's in documentation when the support was *always* broken?
>> I hope the example in documentation is working in older releases.
>> I hasn't tested it.
>
> There's an example in the documentation? Where?
>
> Regards, Dave
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
The Example is installed with MSI-Installer for psqlODBC 08.01.0101.
It's installed as c:/Programme/psqlODBC/docs/howto-vb.html.
Regards
Thomas
________________________________________________________
psqlODBC HOWTO - Visual Basic
Author: Dave Page (dpage(at)postgresql(dot)org)
Release Date: 13 November 2001
Description: Example based Mini-Howto on Accessing PostgreSQL from
Visual Basic
This document provides some sample code to get you started with Visual
Basic & PostgreSQL.
Requirements to get the subroutines to work:
* Visual Basic 5/6
* A reference in the VB project to Microsoft ActiveX Data Objects
* A PostgreSQL datasource.
The example code shown below may need some modification to make it
actually work in your environment. There is one table used in the
example:
CREATE TABLE vbtest(
id int4,
data text,
accessed timestamp
);
Code
Sub Main()
Dim cn as New ADODB.Connection
Dim rs as New ADODB.Recordset
'Open the connection
cn.Open "DSN=<MyDataSourceName>;" & _
"UID=<MyUsername>;" & _
"PWD=<MyPassword>;" & _
"Database=<MyDatabaseName>"
'For updateable recordsets we would typically open a Dynamic
recordset.
'Forward Only recordsets are much faster but can only scroll forward
and
'are read only. Snapshot recordsets are read only, but scroll in both
'directions.
rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic
'Loop though the recordset and print the results
'We will also update the accessed column, but this time access it
through
'the Fields collection. ISO-8601 formatted dates/times are the safest
IMHO.
While Not rs.EOF
Debug.Print rs!id & ": " & rs!data
rs.Fields("accessed") = Format(Now, "yyyy-MM-dd hh:mm:ss")
rs.Update
rs.MoveNext
Wend
'Add a new record to the recordset
rs.AddNew
rs!id = 76
rs!data = 'More random data'
rs!accessed = Format(Now, "yyyy-MM-dd hh:mm:ss")
rs.Update
'Insert a new record into the table
cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random
data');"
'Refresh the recordset to get that last record...
rs.Refresh
'Get the record count
rs.MoveLast
rs.MoveFirst
MsgBox rs.RecordCount & " Records are in the recordset!"
'Cleanup
If rs.State <> adStateClosed Then rs.Close
Set rs = Nothing
If cn.State <> adStateClosed Then cn.Close
Set cn = Nothing
End Sub
Useful Functions
' The escapeString function can be used to fix strings for us in INSERT
and
' UPDATE SQL statements. It will take a value, and return it ready for
' use in your statement as NULL, or quoted with backslashes and single
quotes
' escaped.
Function escapeString(vValue As Variant) As String
If IsNull(vValue) Then
escapeString = "NULL"
else
escapeString = "'" & Replace(Replace(vValue, "", ""), "'", "''"
) &
"'"
end if
End Function
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn
Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte den Absender und löschen Sie diese E-Mail. Das unerlaubte
Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet. Aus
Rechts- und Sicherheitsgründen ist die in dieser E-Mail gegebene Information nicht
rechtsverbindlich.
This e-mail contains confidential and/or privileged information. If you are not the
intended addressee or have received this e-mail in error please notify the sender and
delete this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden. Due to legal and security reasons the information
contained in this e-mail is not legally binding.
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2006-01-06 12:19:51 | Re: Antw: Re: VBA 6 crashes with WIN2K, Postgres 8.1, why? which dll ?? |
Previous Message | Dave Page | 2006-01-06 09:29:48 | Re: VBA 6 crashes with WIN2K, Postgres 8.1, why ? which dll ?? |