For
SQL Tutorial[
^], nice and simple place to start on SQL statements.
For checking is a value is present in a table. The simplest way is
SqlConnection con = new SqlConnection(<Connection string goes where>);
con.Open();
SqlCommand cmd = new SqlCommand("SELECT id FROM tbl WHERE name='Kim'", con);
object value = cmd.ExecuteScalar();
con.Close();
if (value == null)
Console.WriteLine("Value not in table");
else
Console.WriteLine("Value found at id: " + value);