View SQL Stmt Before Execution in ADO.NET?

D

Daryll Shatz

Is there any way to output the completely populated SQL statement that is
about to be executed in ADO.NET? My SQL statements can contain and error
and I woulds like to debug them. Example:
Dim sqlSelect As String = "INSERT INTO Table(col1, col2) VALUES (@col1Value,
@col2Value)

Dim cmdTable As New SqlCommand(sqlSelect, cs)

....

cmdTerritory.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@col1Value", ...))

cmdTerritory.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@col2Value", ...))

' Debug Breakpoint Here

' IS THERE A WAY VIEW THE COMPLETE SQL STATEMENT TO BE EXECUTED???

cmdTerritory.ExecuteNonQuery()
 

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

Top