C# SUbstring - TechRepublic
Question
April 4, 2013 at 11:56 PM
kaithri

C# SUbstring

by kaithri . Updated 13 years, 2 months ago

hi ,

string NewCode = string.Empty;
string input = ;
string txtnameEn = input.Substring(0,5);
string strCode = String.Format( “select ‘{0}’ +RIGHT(‘000’+LTRIM(STR(MAX(Cast(SUBSTRING(code,6,4)as int))+ 1)),4)from horseMaster where code like ‘{0}0%'”,txtnameEn);
DataSet strcode = new DataSet();
DataTable dtCode = DBObj.QueryDB(strCode).Tables[0];
NewCode = dtCode.Rows[0][0].ToString();
return NewCode;

I’m not sure on the string input as i have a lot of txtnameEn. Kindly help!

Regards,

Kai

This discussion is locked

All Comments