0

I can loop through each Parameter in SQL Command but how do I log the parametername and Value?

Public  Sub LogParams(sqlcmd As SqlCommand)
        Dim strParam As String = ""
        For Each p As SqlParameter In sqlcmd.Parameters
             strParam +=      'how to get Name and Value of parameter?
        Next p
End Sub
2
  • 3
    You don't even need to do any research; just use the Visual Studio help!! Type p. and see the suggestions. Commented Oct 15, 2015 at 14:25
  • stared myself blind into the watch on the sqlcmd.parameters. feel like an idiot. thanks for help Commented Oct 15, 2015 at 14:26

1 Answer 1

2

You can use it as

For Each p As SqlParameter In sqlcmd.Parameters
    'p.ParameterName
    'p.Vaalue
Next p
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.