Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ado recordset
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00711984
Message ID:
00712329
Views:
7
>I want to remove the content of a table in Sql-server with ADO.
>I know how to open the recordset and I can delete the records one by one.
>This, however, is very tedious and time-consuming.
>
>To speed this up I´m using the following commands
>rsData = createobject(´adodb.recordset´)
>rsdata.cursortype = ADOPENDYNAMIC
>rsdata.Locktype = ADLOCKBATCHOPTIMISTIC
>
>rsdata.open(´msdsCountry´, adoConnection,,,ADCMDTABLE)
>rsdata.filter=´cocode > ´´´
>rsdata.delete()
>rsdata.updatebatch()
>rsdata.filter = ADFILTERNONE
>
>This seems to work fine, it removes all records in the SQL-server table. It does not, however, ´commit´ the changes. If I ask the properties of the table in SQL-server it still says that 205 rows are present. Opening the table show all records are empty.
>If I want to insert values into the table it will show me an error ´Row handles must all be released before new ones can be obtained´
>
>What am I missing? Why aren´t my updates commited?
>
>Thanks in advance,
>
>Ron Brahma

Try rsdata.CursorType = adOpenStatic, and the rs should be client-side. Also there seems to be no purpose on setting a filter if you will be deleting all records.

If you are just clearing the table then use TRUNCATE as already suggested or "DELETE FROM msdsCountry" if you want to log the deletions. HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform