deepa ashwi

deepa ashwi

  • NA
  • 109
  • 602.1k

id not getting incremented in database in c#asp.net

Jul 30 2013 9:36 PM
In userlogin history i want to dispaly the records according to username,logintime ,logouttime,formname(what all the forms users so long visited list)but here the id(i.e in my project i am using uno) is not getting incremented in database how to make it to get increment..can anyone help me with his
 

following is my code:

protected void Page_Load(object sender, EventArgs e)
{

int uno = 0;
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["constr"]);
con.Open();
string s = "select max(uno) as uno from PayLoginHistory";
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 1)
{

uno = uno + 1;
}
if (Convert.ToString(uno) == "")
{
uno = uno + 1;
}
else
{
uno = uno + 1;
}
 
Session["uno"] = Convert.ToString(uno);
 
}

Answers (5)