Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I delete all the records from a table

Status
Not open for further replies.

tango1948

Programmer
Dec 23, 2006
111
0
0
IL
Hi
I have the following code:
Code:
Try
  With tblUser_adapter
      .FillSchema(ds, SchemaTyped.Mappde, "tblUser")
      .Fill(ds, "tblUser")
      .DeleteCommand.CommandText = "delete from tblUser"
      .Update(ds, "tblUser")
  End With
Catch ex as Exception
  MessageBox.Show(ex.Message)
End Try

What do I need to add to delete all the records from tblUser?

Thanks for any help

David
 
The easist and quickest way is to not bother loading the data at all. You can do this with a SqlCommand object using DELETE FROM tblUser as the CommandText.
 
Hi,
Thanks for the replies I'll do as you suggest.
As a matter of intrest what's missing in my code, deleting all the records is not a good example, but if I want to update records in a table or delete only some records what do I need to add to the code above.

Thanks


david
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top