public string nextMa(string str) { BUS_GIAIDAU temp = new BUS_GIAIDAU(); //get last matk DataTable t = temp.topGIAIDAU(); string Tmag = t.Rows[0].Field <string>(0); //get int in a string to add 1 after string string mastr = Regex.Match(Tmag, @"\d+").Value; int ma = Int32.Parse(mastr); ma++; mastr = null; mastr += str; mastr += ma; return(mastr); }