取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)实际值
小弟现在分少,解决者给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)实际值
...全文
相关推荐
C#和SQL实现的字符串相似度计算代码分享
主要介绍了C#和SQL实现的字符串相似度计算代码分享,本文分别给出了C#语言和SQL语言的实现代码,需要的朋友可以参考下
SQL NULL 值详解
NULL值是SQL中的一种特殊值,它表示未知或不确定的数据。在数据库中,当某个字段的数据未被明确赋值时,该字段通常会存储NULL值。NULL值与空字符串、空集合等不同,它代表的是数据缺失的状态。NULL值是SQL中的一种特殊值,它在数据库中扮演着重要的角色。了解NULL值的概念、使用场景和处理方法,对于编写高效的SQL查询至关重要。在本文中,我们详细介绍了NULL值的相关知识,希望对您有所帮助。本文共2000字,涵盖了SQL NULL值的定义、使用场景、处理方法以及与NULL值相关的常见问题。
sql注入9之堆叠注入
堆叠注入是 SQL 注入攻击的一种形式,攻击者通过注入多个 SQL 语句来执行多个操作。通过分号。
sqlserver中重复数据值只取一条的sql语句
sqlserver中有时候我们需要获取多条重复数据的一条,需要的朋友可以参考下面的语句
sql中返回参数的值
sql中返回参数的值


