C# Delete database records without SQL text?

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

Hi all,

I need to delete rows from my db, when the criteria is: older than a
certain date.
Can it be done without an SQL string query?? Using only a DataSet
and/or DataAdapter?

The regular SQL would be: "DELETE FROM EventLog WHERE
EL_TimeStamp<01/08/2006".
But the problem is using the date in C# and Access-database.

Thanks in advance,
Danny
 
Danny said:
I need to delete rows from my db, when the criteria is: older than a
certain date.
Can it be done without an SQL string query?? Using only a DataSet
and/or DataAdapter?

The regular SQL would be: "DELETE FROM EventLog WHERE
EL_TimeStamp<01/08/2006".
But the problem is using the date in C# and Access-database.

Rather than embedding the date directly into the SQL, use a
parameterised SQL statement.

See http://www.pobox.com/~skeet/csharp/faq/#db.parameters
 
Back
Top