Check the type of your recordset, and then check the docs and see how that type
of recordset supports the RecordCount property. Or, post the code that sets up
the connection and recordset so we can take a look at it. If you really want to
keep deleting until there are none left, you could probably avoid the
RecordCount property altogether by changing the loop condition to:
Do Until rstRecord2.EOF
You also might consider finding a way to do the same thing with a
straightforward SQL statement. For instance, if you want to delete everyone
whose name is Smith, it looks like you're currently setting a recordset equal to
the results of "select name from customer where name='smith'", then cycling
through the recordset to delete them until there are none left. Quicker is to
execute a simple "delete from customer where name='smith'".
HTH,
Wes
"Ryan C. Bonham" <Ryan%srfarms.com@interlock.lexmark.com> on 07/27/2001 12:59:36
PM
To: pgsql-odbc%postgresql.org@interlock.lexmark.com
cc: pgsql-general%postgresql.org@interlock.lexmark.com (bcc: Wesley
Sheldahl/Lex/Lexmark)
Subject: [GENERAL] 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
VB CODE
rstRecord2.MoveFirst
Do Until rstRecord2.RecordCount = 0
rstRecord2.Delete
rstReocrd2.MoveNext
Debug.Print rstRecord2.RecordCount
Loop
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html