Created
February 19, 2020 14:02
-
-
Save hasokeric/f5ca5a5f9fd52a9b7f8d10c82966aea6 to your computer and use it in GitHub Desktop.
Regex Match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!string.IsNullOrEmpty(id)) | |
{ | |
int counter = 0; | |
string sPartNum = id + "-"; | |
bool recSelected; | |
//string whereClause = "[PartList].[PartNum] = (SELECT TOP 1 [PartNum] FROM [Erp].[Part] WHERE [Part].[Company] = [PartList].[Company] AND [Part].[PartNum] LIKE '" + sPartNum + "%' and 12345=12345 ORDER BY [PartNum] DESC)"; | |
string whereClause = "PartNum LIKE '" + sPartNum + "%' BY CreatedOn DESC"; | |
//nextSeq.ToString().PadLeft(5, '0'); | |
// Current company only | |
DataSet ds = SearchFunctions.listLookup(this.oTrans, "PartAdapter", out recSelected, false, whereClause, false); | |
if (recSelected) { | |
//DataRow x = ds.Tables[0].Rows[0]["PartNum"]; | |
int nextSeq = Convert.ToInt32(System.Text.RegularExpressions.Regex.Match(ds.Tables[0].Rows[0]["PartNum"].ToString(), @"\d+").ToString().PadLeft(5, '0')) + 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment