[英]auto increment no in textbox From Database c#
string connectionstring = ConfigurationManager.ConnectionStrings["myConnectionString2"].ConnectionString;
SqlConnection con = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter("Select Max(VchNo) from tran1 where VchType=9 ", con);
DataSet ds = new DataSet();
da.Fill(ds);
txtCIN.Text = ds.Tables[0].Rows[0][0].ToString();
txtCIN.Text = Convert.ToString(Convert.ToInt32(txtCIN.Text) + 1);
string connectionstring = ConfigurationManager.ConnectionStrings["myConnectionString2"].ConnectionString;
SqlConnection con = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter("Select Max(VchNo) from tran1 where VchType=9 ", con);
DataSet ds = new DataSet();
da.Fill(ds);
string vchno = ds.Tables[0].Rows[0][0].ToString();
string a = vchno;
a = vchno.Substring(0,(a.Length-8));
a = (int.Parse(a) + 1).ToString();
txtCIN.Text = a +"/2018-19";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.