471,056 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,056 software developers and data experts.

C# Delete database records without SQL text?

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

Aug 5 '06 #1
1 1454
Danny <da*******@yahoo.comwrote:
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

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Aug 5 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Philip Boonzaaier | last post: by
9 posts views Thread by Robert Schneider | last post: by
2 posts views Thread by Joe Del Medico | last post: by
2 posts views Thread by Ryan McConnell | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.