Is it possible to get the parsed text of a SqlCommand with SqlParameters?

后端 未结 4 2067
情话喂你
情话喂你 2020-12-11 02:00

What I am trying to do is create some arbitrary sql command with parameters, set the values and types of the parameters, and then return the parsed sql command - with parame

4条回答
  •  没有蜡笔的小新
    2020-12-11 02:12

    Joel Coehoorn is right, it's not just a simple string substitution or escape character adding, etc.

    You can, however, view your parameters to see if your values are as you want them:

    foreach (IDataParameter i in cmd.Parameters)
    {
        Console.WriteLine(i.Value.ToString());
    }
    

提交回复
热议问题