SqlDataAdapter da2 = new
SqlDataAdapter(SelectInvoiceID, cn);
DataSet dsInvoiceID = new DataSet();
da2.Fill(dsInvoiceID);
if (dsInvoiceID.Tables[0].Rows.Count != 0)
{
int a =
Convert.ToInt16(dsInvoiceID.Tables[0].Rows[0]["Count"].ToString());
int C = a + 1;
//ID
creates dynamically if ID count <10
if (C > 0 && C <= 9)
{
ID = "abc0000" + C;
}
//ID creates dynamically if ID
count 10 to 99
else if (C > 9 && C <= 99)
{
ID = "abc000" + C;
}
//ID creates dynamically if ID
count 100 to 999
else if (C > 99 && C <= 999) ID =
"abc00" + C;
//ID creates dynamically if ID
count 1000 to 9999
else if (C > 999 && C <= 9999) ID =
"abc0" + C;
//ID creates dynamically if ID
count 10000 to 99999
else if (C > 9999 && C <= 99999) ID = "abc"
+ C;