Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ado recordset
Message
From
16/10/2002 16:47:48
Fabian Belo
Independent Developer
Argentina
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00711984
Message ID:
00711992
Views:
7
If you want to delete all the data from a table it's much more efficient to use a different type of statement: TRUNCATE TABLE
This statemenet removes all the data and resets the identity column value to its default. Remember, data is unrecoverable.
Regards


>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
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Previous
Reply
Map
View

Click here to load this message in the networking platform