Deleting All Records -ADODC1 control ado vb6

Deleting All Records -ADODC1 control ado vb6

Post by David Powel » Mon, 17 Jan 2000 04:00:00



To All,
I have all kinds of code to delete current records from the recordset of
the adodc1 control.
How do you delete ALL  the records in the table?
Control
ADODC1
RecordSource Access97   MyData.mdb
recordset  table     "MyTable"
Thanks
fordraiders
 
 
 

Deleting All Records -ADODC1 control ado vb6

Post by Jim in Clevelan » Mon, 17 Jan 2000 04:00:00



> I have all kinds of code to delete current records from the recordset of
> the adodc1 control.
> How do you delete ALL  the records in the table?
> Control
> ADODC1
> RecordSource Access97   MyData.mdb
> recordset  table     "MyTable"

Using the DataControl may not be the ideal way to perform this task, but
you could start at the first record and run a loop like:

With Adodc1.Recordset
  Do Until .EOF
    .Delete
    .MoveNext
  Loop
End With

Depending on # of records, could take awhile.  Another option is to use
code to open a connection to the db and execute an SQL statement -
"DELETE FROM MyTable" - and delete all records in one step.
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"

"What's so funny 'bout peace, love & understanding?"
     - Nick Lowe

 
 
 

1. ADO Data Control Delete Record

How about:

  Adodc1.Recordset.Delete
  Adodc1.Recordset.Update

...then Requery, Refresh?

Just wondering:   What's your RecordSource property for this
Adodc?...and why do have CommandType adCmdUnknown?  
VB Help sez: "If the CommandType property value equals adCmdUnknown (the
default value), you may experience diminished performance because ADO
must make calls to the provider to determine if the CommandText property
is an SQL statement, a stored procedure, or a table name. If you know
what type of command you're using, setting the CommandType property
instructs ADO to go directly to the relevant code."
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"

"What's so funny 'bout peace, love & understanding?"
     - Nick Lowe

2. Reading/Importing UNICODE

3. Error Deleting Record using ADO Data Control

4. SCALA5 Mailing List Available!

5. VB6 ADO and Multiple Records/Single Records

6. Convert 4.9 to 10.0

7. ado .delete deletes joined table records?

8. TableSpace and users

9. adodc1 control

10. Error reading records with double quotes through data control in VB6

11. VB6 - Deleting Records based in AND condition is not working correctly

12. Editing and deleting record from access using VB6