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

RE: [ODBC] Visual Basic and PostgreSQL ODBC

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Ryan C(dot) Bonham'" <Ryan(at)srfarms(dot)com>, pgsql-odbc(at)postgresql(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: RE: [ODBC] Visual Basic and PostgreSQL ODBC
Date: 2001-07-30 07:19:38
Message-ID: (view raw or whole thread)
Lists: pgsql-generalpgsql-odbc

> -----Original Message-----
> From: Ryan C. Bonham [mailto:Ryan(at)srfarms(dot)com] 
> Sent: 27 July 2001 18:00
> To: pgsql-odbc(at)postgresql(dot)org
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: [ODBC] Visual Basic and PostgreSQL ODBC
> Hi,
> Ok I have a problem, that I need to find a fix or workaround 
> for. I have a Visual Basic 6 application that calls on a 
> PostgreSQL database. I have code that calls a table and runs 
> a loop on it, deleting recordsets until the recordcount 
> equals a certain number.. The code deletes the records fine, 
> the problem is the recordcount doesn't change.. Does anyone 
> know what is going on and how to fix it?  Thank you
> Ryan
>         rstRecord2.MoveFirst
>     Do Until rstRecord2.RecordCount = 0
>         rstRecord2.Delete
> 	  rstReocrd2.MoveNext
>         Debug.Print rstRecord2.RecordCount
>     Loop

Try the following:

  Do Until rstRecord2.RecordCount = 0
  Debug.Print rstRecord2.RecordCount

The RecordCount property normally remains at zero until you've moved to the
end of the recordset, hence you need to MoveLast first. This can be a
resource issue though if you have large recordsets as this will cause the
entire recordset to be read from PostgreSQL. If you can though, you will
probably be better off executing a DELETE FROM sql query, and then
refreshing the recordset, or if you are always deleting all records in the
recordset, try:

  While Not rstRecord2.EOF

regards, Dave.

pgsql-odbc by date

Next:From: Henshall, Stuart - WCPDate: 2001-07-30 08:34:37
Subject: RE: A problem with the nextval('') function
Previous:From: Dave PageDate: 2001-07-30 07:11:33
Subject: RE: Error with DECIMAL or NUMERIC data type

pgsql-general by date

Next:From: Kapil TilwaniDate: 2001-07-30 12:31:11
Subject: C / FoxPro
Previous:From: Hiroshi InoueDate: 2001-07-30 07:19:20
Subject: Re: Re: "Oracle's ROWNUM"

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