GG asked ... Fix food processor motor?    |    T asked ... How do I turn the delay off on Electrolux DX302 dishwasher?    |    Helen asked ... How can I mend my Kenwood Gourmet FP505?    |    Roy Turner asked ... Kohlangaz Gosford HE fire?    |    Peter asked ... How can I mend a Powerwasher PRO PRO1800PWE?    |    Click here to ask your question

How can I delete all rows in a data table?

I have a VB.Net question. I am having trouble deleting all rows in a data table. I am using this code........

Dim ConnStr As String = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + System.Windows.Forms.Application.StartupPath + "\Clip Counter.mdb"
Dim DT As New DataTable()
Dim SQLStr As String = "SELECT * FROM [Clips_Data]"
Dim DA As New OleDb.OleDbDataAdapter(SQLStr, ConnStr)
Dim CommandBuilder As New OleDb.OleDbCommandBuilder(DA)
DA.Fill(DT)
DT.Rows.Clear()
DA.Update(DT)

........After the clear command all the table's rows are deleted, but it seems as though the change is not saved. What am I doing wrong?
P., February 2004
You basically need to change your SQLStr. Use the lines below instead of your example.

Dim ConnStr As String = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + System.Windows.Forms.Application.StartupPath + "\Clip Counter.mdb"
Dim DT As New DataTable()
Dim SQLStr As String = "DELETE * FROM [Clips_Data]"
Dim DA As New OleDb.OleDbDataAdapter(SQLStr, ConnStr)
Dim CommandBuilder As New OleDb.OleDbCommandBuilder(DA)
DA.Fill(DT)
DA.Update(DT)
DA.Dispose()

Andrew Croft, February 2004
link Click here to see other fixes for Microsoft.