I want to make a program for value prechecking .a user will give the single input (wbslement no) to UI .I want to insert that record into System . Before inserting into database I want to check It is present in Table or not . if it is present in table then It should not insert record into table if it is not present into database then it should insert .
currently at load time I am fetching all the records from table after that I am trying to insert into System.
in my code it is inserted value any case
            CrCon = new SqlConnection(spcallloggin);
            CrCon.Open();
            CrCmd = new SqlCommand();
            CrCmd.Connection = CrCon;
            CrCmd.CommandText = "GetOraderNumberDetail";
            CrCmd.CommandType = CommandType.StoredProcedure;
            sqladpter = new SqlDataAdapter(CrCmd);
            ds = new DataSet();
            sqladpter.Fill(ds);
            for (int count = 0; count < ds.Tables[0].Rows.Count; count++)
            {
                if (txtwbs.Text == ds.Tables[0].Rows[count][0].ToString())
                {
                            Lbmsg.Visible = true;
                            Lbmsg.Text = "Data Already Exists !";
                            count = count + 1;
                 }
                 else
                 {
                       insetreco(val);
                 }
             }
 
     
     
     
    