此功能是在打開頁面前先到資料表搜尋最大值,Select完後將資料丟進DataTable
該欄位為字串型態,寫法如下:
DbAgent sqlHelper = new DbAgent();
DbCommand sqlValue = sqlHelper.getDbCommand(m_ConfigDBName);
StringBuilder sqlstr = new StringBuilder();
SqlParameter par;
sqlValue.CommandText = @"SELECT MAX(CALL_NO) as MAXCALLNO
FROM NAM_NAME(nolock)
WHERE CALL_NO LIKE '%' + @CALL_NO +'%' ";
par = new SqlParameter("CALL_NO", SqlDbType.NVarChar);
par.Value = pYear;
sqlValue.Parameters.Add(par);
try
{
DataTable dt = sqlHelper.QueryToDataTable(sqlValue, pInfo);
return dt;
}
catch (Exception ex)
{
throw ex;
}
沒有留言:
張貼留言