My application creates hostnames in sequence. Users can delete hostnames. Too late for soft deletes. After the app creates a hostname it checks to see if the created name and the one in the database are the same. If so, increment the count and check again. But, it only checks that record, I need to kept checking and incrementing till I hit a null row. How do you do that? Here is my code below.
private void InsertRecord(string host, DateTime dateadded, int requestID, string smc, string serialNum, string description, string firstname, string lastname)
{
string dbHost = lblHostname.Text;
dateadded = DateTime.Now;
if (Session["Inserted"] == null)
{
string sql = "SELECT * FROM HostName WHERE Host='" + dbHost + "'";
using (SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]))
{
cn.Open();
SqlCommand cmd = new SqlComma ...
Go to the complete details ...