: Hey Thanks alot,
: could you write me a sample of what the code would look like? I just dont see it being under 20 lines. This application needs to automatically delete old records and I should use it in my windows schedule tasks.
: Thanks.
:
static int Main(void)
{
SqlConnection conn = new SqlConnect(ion"connection string here");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
// Delete rows that are more than 10 days old
cmd.CommandText = "DELETE FROM MyTable WHERE MyTimeStampField < DATEADD(day, 10 GETDATE())"
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}