From: "pakorn" <pakorn_Nong(at)hotmail(dot)com>
To: <pgsql-odbc(at)postgresql(dot)org>
Subject:
Date: 2002-05-18 07:10:44
Message-ID: LAW2-OE67NYkIhsZSls0000794a@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Dear , Sir
I use PostGreSQL on Redhat 7.1 and use VB6.0 connect by ODBC to PostGreSql

This sample code from VB
Private Sub ADO_Store()
Dim cn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim chunk() As Byte
Dim fd As Integer
Dim flen As Long
Dim main As ADODB.Parameter
Dim object As ADODB.Parameter

' Connect to the database using ODBC
With cn
.ConnectionString = "dsn=PostgreSQL;"
.Open
.CursorLocation = adUseClient
End With

' Here is an example if you want to issue a direct command to the database
'
'Set cmd = New ADODB.Command
'With cmd
' .CommandText = "delete from MYTABLE"
' .ActiveConnection = cn
' .Execute
'End With
'Set cmd = Nothing

'
' Here is an example of how insert directly into the database without using
' a recordset and the AddNew method
'
Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandText = "insert into MYTABLE(main,object) values(?,?)"
cmd.CommandType = adCmdText

' The main parameter
Set main = cmd.CreateParameter("main", adInteger, adParamInput)
main.Value = 100 '' a random integer value ''
cmd.Parameters.Append main

' Open the file for reading
fd = FreeFile
Open "mydocument" For Binary Access Read As fd
flen = LOF(fd)
If flen = 0 Then
Close
MsgBox "Error while opening the file"
End
End If

' The object parameter
'
' The fourth parameter indicates the memory to allocate to store the object
Set object = cmd.CreateParameter("object", _
adLongVarBinary, _
adParamInput, _
flen + 100)
ReDim chunk(1 To flen)
Get fd, , chunk()

' Insert the object into the parameter object
object.AppendChunk chunk()
cmd.Parameters.Append object

' Now execute the command
Set rs = cmd.Execute

' ... and close all
cn.Close
Close
End Sub

Private Sub Command1_Click()
Call ADO_Store
End Sub

AND i cann't connect to Server have a message (in Attach file)
What i wrong please help me

Thank you
Me.Pakorn Uawacharo
Thailand

Attachment Content-Type Size
image/jpeg 21.9 KB
image/jpeg 15.0 KB

Browse pgsql-odbc by date

  From Date Subject
Next Message Jean-Michel POURE 2002-05-18 16:53:19 UTF-8 safe ascii() function
Previous Message Francisco Jr. 2002-05-18 03:18:50 [ANN] Npgsql version 0.1 Released!