how to pass parameter to data source in code

tcl4p

Well-known member
Joined
Feb 29, 2008
Messages
48
Programming Experience
1-3
I set up a data source to a combo box using the data source wizard (from the tag on the combo box). The problem is I set the data source to a stored procedure which requires a parameter and I can't find a way to pass the parameter to the data source. I would have thought the wizard would know that since I selected a stored procedure, it would know it would require a parameter and have an additional dialog to set the parameter source.
So, can someone tell how to pass a parameter to the data source? I assume that I have to run the line of code prior to the fill method running (code generated from wizard).
'TODO: This line of code loads data into the 'DsPPEDisposal.PPEDisposal' table. You can move, or remove it, as needed.
Me.PPEDisposalTableAdapter.Fill(Me.DsPPEDisposal.PPEDisposal)

Thanks,
Tom
 
If you had linked to a stored procedure that required a parameter, then an entry in the parameters collection would have been generated and the fill command that generated would have looked like this:

Fill(datatable, THE_PARAMETER_VALUE_HERE)

instead of what you currently have:

Fill(datatable)


-
Check again the method by which you brought the stored procedure into the dataset/tableadapter (click on the Fill... in the tableadapter and then look at the properties: is it type StoredProcedure? Does the Parameters collection contain entries? What does the CommandText contain? (it should be just FUNCTIONNAME(), if you did SELECT functionName() instead, and youre running it like a query, then you forgot to put the param name into the SQL statement.. Dont do it as a select (type=Text), do it as a SP call proper =just FUNCTIONNAME as query text
 
Back
Top