取SQL文中的参数实际值
大家好,请高手帮忙解决个问题,我要把SQL文取出来现在已经可以了,但涉及到有的SQL文中是根据参数检索和插入的,现在我只能获取参数变量,但无法获取参数实际值
小弟现在分少,解决者给10分,以后分多,好好报答
public DataTable FindPWD(string userID)
{
SXSysLog.Debug("SXI90130", "FindPWD");
// SQL文を組み立てる
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(" P.\"パスワード\", ");
strSql.Append(" P.\"設定年月日\", ");
strSql.Append(" P.\"設定時刻\" ");
strSql.Append("FROM \"C_パスワード\" P, \"M_ユーザーID\" U ");
strSql.Append("WHERE P.\"ユーザーID\" = :UserID ");
strSql.Append(" AND P.\"ユーザーID\" = U.\"ユーザーID\" ");
strSql.Append(" AND U.\"有効無効区分\" = 0 ");
strSql.Append("ORDER BY P.\"設定年月日\"||P.\"設定時刻\" DESC");
FxCommand fxCommand = new FxCommand();
// コマンドにSQL文を設定する
fxCommand.CommandText = strSql.ToString();
// SQLパラメータを設定する
fxCommand.Parameters.AddWithValue(":UserID", userID);// 参数替换
// SQL文を発行する
DataTable dataTbl = new DataTable();
object objFailedCount = SXDataAccessHelper.Fill(fxCommand, dataTbl);
SXSysLog.Debug("SXI90140", "FindPWD");
return dataTbl;
}
public static int Fill(FxCommand fxCommand, DataTable table)
{
// システムログの開始
SXSysLog.Debug("SXI90130", "Fill");
string strSql = fxCommand.CommandText;
SXInspectionLog.Write(strSql);
int intRet = FxDataAccessHelper.Fill(fxCommand, table);
// システムログの終了
SXSysLog.Debug("SXI90140", "Fill");
return intRet;
}
string strSql = fxCommand.CommandText;
SXInspectionLog.Write(strSql);
带颜色的这两句可以获得SQL文,但无法获取参数(userID)实际值