I'm having a hard time to find out how to pass at run time a parameter which I defined in a开发者_高级运维n adapter in a dataset. When I preview the data I can insert the value manually, but I was not able to find any code around how to pass it in the visual basic code. Any help will be appreciated ;-) Thanks in advance for your help Georges-Louis
I didn't realize you mentioned Forms.
Have you tried creating a Public Function method with attributes? Maybe I'm not clear on the question, but you mean you have a defined value for your dataapapter, then you want to change it at run time, is this correct? Do you have that value as a variable?
When you call the function that fills the TableAdapter you can specify the parameter to pass to the query or stored procedure.
Private Sub frmReport_Load(ByVal sender As System.Object, ByVal e as System.EventArgs) Handles MyBase.Load
' strParam is your parameter to pass to the query
Me.dtReportTableAdapter.FillByDate(Me.DataSet1.dtReport, strParam)
Me.ReportViewer1.RefreshReport()
End Sub
I hope this helps.
精彩评论