Hi
I have below code . If already exists it should not be added
string constr = ConfigurationManager.ConnectionStrings["Cnn"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { string query = "INSERT INTO Category VALUES (@CategoryId,@CategoryName)"; using (SqlCommand cmd = new SqlCommand(query)) { cmd.Connection = con; cmd.Parameters.AddWithValue("@CategoryId", data.id); cmd.Parameters.AddWithValue("@CategoryName", data.snippet.title); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } }
Thanks