In effetti non è poi così brutta come soluzione, quella di adottare una funzione. Ho fatto come vedi sotto, le passo come unico parametro l'SqlCommand di cui mi viene restituita la CommandText elaborata con l'applicazione dei parametri.
Strano però che non ci sia una proprietà o metodo proprio del command...
codice:
Public Function TrasformaSql(ByVal cmd As SqlCommand) As String
Dim tempSql As String = cmd.CommandText
For Each Parametro As SqlParameter In cmd.Parameters
With Parametro
If .SqlDbType = SqlDbType.Char Or .SqlDbType = SqlDbType.Text Or .SqlDbType = SqlDbType.VarChar Then
tempSql = tempSql.Replace(.ParameterName, "'" & (.Value) & "'")
ElseIf .SqlDbType = SqlDbType.DateTime Then
tempSql = tempSql.Replace(.ParameterName, "'" & Year(.Value) & "-" & Month(.Value) & "-" & Day(.Value) & "'")
ElseIf .SqlDbType = SqlDbType.Bit Then
tempSql = tempSql.Replace(.ParameterName, IIf(.Value, 1, 0))
Else
tempSql = tempSql.Replace(.ParameterName, Str(.Value).Replace(",", "."))
End If
End With
Next
Return tempSql
End Function