string query = string.Format("SELECT id from table where id = {0}", myID);
SqlCommand comd = new SqlCommand("SELECT id from table where id =1",connection); string strID= comd.ExecuteScalar().ToString(); if(strID==""){MessageBox.Show("ID not Found !!");}else{MessageBox.Show("ID Already Exits !!");}
SELECT MAX(ID) AS ID FROM table
string query = string.Format(@"IF EXISTS (SELECT NULL FROM Table WHERE ID = {0}) SELECT 'Key Already Exists' ELSE SELECT 'Key Not Found'", myID);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)