Monday, 5 January 2015

Auto Genetare ID by using C#(Akram)

public void Autogen_catcode() / / function for autogen Code
    {
        DataSet DS = new DataSet();
        DS = dlr.RET_AUTOGEN_CATCODE(plr); //-using layer
        if (DS.Tables[0].Rows.Count > 0 && DS != null && DS.Tables[0] != null) //-compairesion if not null.
        {
            int code1 = Convert.ToInt32(DS.Tables[0].Rows[0][0].ToString()) + 1;
            string code2 = code1.ToString("0000");
            txtcatcode.Text = name + code2.ToString();

        }
        else
        {
            txtcatcode.Text = id;

        }
    }

Example-'Cu001'

No comments:

Post a Comment