Hi
For checking record form db you can use
SlqDataReader
if you in SQL Server platform, and for update you can use ExecuteNonQuery method in
SqlCommand
object for example:
public class Class1
{
public void Execute()
{
SqlConnection readerconn = new SqlConnection(Properties.Settings.Default.ConnectionString);
readerconn .Open();
SqlCommand cmd = new SqlCommand("SELECT ID , Date FROM Table1", readerconn );
SqlDataReader reader = cmd.ExecuteReader();
SqlConnection writerconn = new SqlConnection(Properties.Settings.Default.ConnectionString);
writerconn .Open();
SqlCommand writerCommand = new SqlCommand("", writerconn );
while (reader.Read())
{
int ID = reader.GetInt32(0);
DateTime Date = reader.GetDateTime(1);
writerCommand.CommandText = "UPDATE Table1 SET Date = '" + EventDate.AddDays(1).ToString() + "' WHERE ID = " + ID.ToString();
writerCommand.ExecuteNonQuery();
}
}
}
If you want get more information about Update,Delete,Insert and Reading record with ADO.NET please refer here:
Simple ADO.NET Database Read, Insert, Update and Delete using C#.[
^]
Best Regards.