I have the ff. code...
t is called by:Code:public string GetNewID(string tableName) { const string stringSql = "SELECT CurrentValue FROM Sequences WHERE TableName = ?"; _dataAccess.PrepareQuery(stringSql); //_dataAccess.AddParameter("TableName", (System.String)stringTableName); _dataAccess.AddWhereParameter("TableName", "EmployeeID"); int result = (int)_dataAccess.GetFieldValue; // Since I am formating the result with 5 0's (00000) I have to check // whether I have reach passed 5 digit numbers, if I have then // I should reset it to one. if (result.Equals(100000)) { const string stringUpdateSequence = "UPDATE Sequences SET CurrentValue = 1 WHERE TableName = ?"; _dataAccess.PrepareQuery(stringUpdateSequence); _dataAccess.AddParameter("TableName", "EmployeeID"); _dataAccess.ExecuteActionQuery(); } int currentValue = _dataAccess.GetNextSequenceNumber("EmployeeID"); return string.Format("{0:yy-MM}-{1:00000}", DateTime.Now, currentValue); }
If you may notice I have a parameter tableName which I intend to fill the value for the parameters I would pass like...Code:public static string GetNewCode() { string newCode = _dataPortal.GetNewID("EmpoyeeID"); return newCode; }
Problem is if I do that it causes an error, I can't get the ...Code:_dataAccess.AddWhereParameter("TableName", tableName);
To work since it is returning a null value, whereas if I hardcode it all is working well, what seems to be the problem? This is really strange...Code:(int)_dataAccess.GetFieldValue![]()




Reply With Quote