- Архив списков рассылки pgsql-odbc

Поиск
Список
Период
Сортировка
От pakorn
Тема
Дата
Msg-id LAW2-OE67NYkIhsZSls0000794a@hotmail.com
обсуждение исходный текст
Список 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
 
 
Вложения

В списке pgsql-odbc по дате отправления:

Предыдущее
От: Hiroshi Inoue
Дата:
Сообщение: Re: int8 defined as text in MS Access?
Следующее
От: Hiroshi Inoue
Дата:
Сообщение: Re: Is there a limit on what can be returned?