Skip site navigation (1) Skip section navigation (2)


From: "Graham Vickrage" <graham(at)digitalplanit(dot)com>
To: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>, <pgsql-odbc(at)postgreSQL(dot)org>
Date: 2001-04-30 13:30:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
RE: [INTERFACES] VB and ODBCThanks again for that, now that I have achieved
this, my last question (hopefully :-) is, can I do all the below over a
secure connection. I have read up on how to do it via a terminal but does
anyone know if I can do all this wrapped up in a VB module?



 -----Original Message-----
From: Dave Page [mailto:dpage(at)vale-housing(dot)co(dot)uk]
Sent: 30 April 2001 08:25
To: 'Graham Vickrage'; 'pgsql-odbc(at)postgreSQL(dot)org'

  [CC'd to the ODBC List]


  I wouldn't have thought that you would need any extra libraries (all you
should need come with MDAC) - though you may need to reference them from
within your project. In VB you do this in the Project -> References  menu
option. I use ADO technology for which you need the 'Microsoft ActiveX Data
Objects 2.6 Library'. There are also earlier versions you could use (2.5,
2.1 or 2.0).

  Basic code to open a connection, run a query and iterate though the
results would look like:

  Sub Main()
  Dim cn as New ADODB.Connection
  Dim rs as New ADODB.Recordset

    'Open the connection
    cn.Open "DSN=PostgreSQL;UID=dave;PWD=password;"

    'Open the recordset
    rs.Open "SELECT relname FROM pg_class", cn

    'Loop though the recordset print the results
    While Not rs.EOF
      Debug.Print rs!relname

    If rs.State <> adStateClosed Then rs.Close
    Set rs = Nothing
    If cn.State <> adStateClosed Then cn.Close
    Set cn = Nothing
  End Sub

  HTH, Regards,

    -----Original Message-----
    From: Graham Vickrage [mailto:graham(at)digitalplanit(dot)com]
    Sent: 28 April 2001 14:35
    To: Dave Page
    Subject: RE: [INTERFACES] VB and ODBC


    I am using VBA, is it a case that the solution you have needs libraries
that only Studio has? If this is the case then could I not import these
libraries? Maybe the code would be useful even so, if you don't mind sending
it me it would be a great help.


      -----Original Message-----
      From: Dave Page [mailto:dpage(at)vale-housing(dot)co(dot)uk]
      Sent: 27 April 2001 21:03
      To: 'Graham Vickrage'; Michael Ansley (UK);
      Subject: RE: [INTERFACES] VB and ODBC

        -----Original Message-----
        From: Graham Vickrage [mailto:graham(at)digitalplanit(dot)com]
        Sent: 27 April 2001 18:03
        To: Michael Ansley (UK); pgsql-interfaces(at)postgresql(dot)org
        Subject: RE: [INTERFACES] VB and ODBC

        Thanks for the advice, but I seem to still be having probs.

        I can't leave out the name param as its required so the only option
is to leave it blank. If I put anything else in its place then it comes back
with an error that the files does not exist.

        When I give an empty string as the name there are no errors, so
assuming this is working how do I then extract the data from the
dataconnectioin and print it in the doc?

        With perl DBI it might be something like
        $query = DBI->connect(etc...) ;

        What it the equivelant for VB?

      From your earlier post aren't you actually using VBA (Visual Basic for
Applications)? i.e. in Word - if not let me know and I'll post some sample
VB (as in the part of Visual Studio) code for you.

      As for the ODBC driver, the office PostgreSQL driver is available at There are .dlls in the Versions
directory, and in the test directory is a full installation which seems to
work well.

      hth, regards Dave.

In response to

pgsql-odbc by date

Next:From: Hiroshi InoueDate: 2001-04-30 23:56:49
Subject: Re: [HACKERS] Bug in ODBC driver
Previous:From: Jan WieckDate: 2001-04-30 13:05:36
Subject: Bug in ODBC driver

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group