Getting formated SQL

  • Thread starter Thread starter Emerson Yukio Honda
  • Start date Start date
E

Emerson Yukio Honda

With the code below :

SqlParameterDictionary sqlParamDic = new SqlParameterDictionary();

StringBuilder sqlBuilder = new StringBuilder();

string sql;

sqlBuilder.Append( "insert products (product) ");

sqlBuilder.AppendFormat( "values (@name) ", product.Name);

sql = sqlBuilder.ToString();

sqlParamDic.Add( new SqlParameter( "@name", product.Name ) );

SqlHelper.ExecuteNonQuery( GlobalFunctions.GetConnectionString(),
CommandType.Text, sql, sqlParamDic );

How can I get the SQL witch framework used to insert into the database? When
I check at commandtext, its still with the placeholders.

Emerson
 
You can use the Sql Server profiler to see what the actual values are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top