I need to debug some code involving SqlDataSource SelectParameters, and I would like to get the value of these parameters, but so far I'm only able to get the name of the parameters.
Dim debug As String = "Parameter 1: " & SqlDataSource1.SelectParameters.Item(0).ToString() & "<br />" & _
"Parameter 2: " & SqlDataSource1.SelectParameters.Item(1).ToString() & "<br />" & _
"Parameter 3: " & SqlDataSource1.SelectParameters.Item(2).ToString() & "<br />" & _
"Parameter 4: " & SqlDataSource1.SelectParameters.Item(3).ToString() & "<br />" & _
"Parameter 5: " & SqlDataSource1.SelectParameters.Item(4).ToString() & "<br />" & _
"Parameter 6: " & SqlDataSource1.SelectParameters.Item(5).ToString() & "<br />" & _
"Parameter 7: " & SqlDataSource1.SelectParameters.Item(6).ToString() & "<br />" & _
"Parameter 8: " & SqlDataSource1.SelectParameters.Item(7).ToString() & "<br />" & _
"Parameter 9: " & SqlDataSource1.SelectParameters.Item(8).ToString() & "<br />"
Label3.Text = debug
Output:
Parameter 1: institution
Parameter 2: type
Parameter 3: skoleaar
Parameter 4: termin
Parameter 5: fag
Parameter 6: niveau
Parameter 7: tid
Parameter 8: fritekst
Parameter 9: orderby
That's the name of the parameters, where I need the values.
Is this possible?
If you handle the Selecting
event of the SqlDataSourceControl
, the Command
property of the SqlDataSourceEventArgs
parameter will give you the DbCommand
which is about to execute. From there, you can use the Parameters
property to examine the parameters being passed to the command.