Below is the code thats giving me an error
Dim adapter As New DataSetTableAdapters.SentEmailTableAdapter
Dim table As New DataSet.SentEmailDataTable
adapter.GetDataByDate(table, batchflag, startdate, enddate)
Value of type 'DataSet.SentEmailDataTable' cannot be converted to 'String'.
Too many arguments to 'Public Overridable Overloads Function GetDataByDate(BatchFlag As String, StartDate As Date?, EndDate As Date?) As DataSet.SentEmailDataTable'.
But this code works with no error. As you can see I pass it a table and one parameter.
Dim adapter As New DataSetTableAdapters.EmployeesTableAdapter
Dim table As New DataSet.EmployeesDataTable
adapter.GetDataByRegion(table, state)
The error and method signature is very clear. The GetDataBydate does not have an overload signature that matches your calling code. Take a moments to review your custom code.
Value of type 'DataSet.SentEmailDataTable' cannot be converted to 'String'.
Too many arguments to 'Public Overridable Overloads Function GetDataByDate(BatchFlag As String, StartDate As Date?, EndDate As Date?) As DataSet.SentEmailDataTable'.
According to the error message, this indicates that the actual parameter you are passing does not match the formal parameter type. In the method GetDataByDate, the first parameter is string type, while you are actually passing datatable type.
The normal working code you mentioned below, the method you call is GetDataByRegion, which is not the same as the method you have error in.
Please confirm the construction of these methods and their parameter types to ensure that the parameter types you passed in are correct.
I'm not sure if either one of these replies are correct, but I appreciate the help. Anyway, what I discovered is that I need to use the fill method for the adapter; that's why it didn't like those arguments. For example,
Dim adapter
AsNew DataSetTableAdapters.tbl_EmployeeTableAdapter
Dim table
AsNewDataSet.tbl_EmployeeDataTable
adapter.FillByState(table, state)
But if you know of any good examples where someone used a table adapter with an rdlc report where they also passed multiple data parameters using a url query string, then that is what I am trying to accomplish. Thanks !!!
According to your description, do you want to get the data source of the database first, then filter the data and bind it to RDLC?
Is the FillByState here your custom method?
If so, when you successfully get the data source you need, assign the data source to the corresponding ReportViewer control.
You can refer to the following code:
Using cn As New SqlConnection(gcs)
cn.Open()
Dim sa As New SqlDataAdapter(sql, cn)
sa.SelectCommand.CommandTimeout = cGlobals.ReportTimeout
sa.Fill(ds, "Foos")
End Using
bs.DataSource = ds
bs.DataMember = "Foos"
Dim rds As New ReportDataSource
rds.Name = "dsFooList_Foos"rds.Value = bs
rv1.LocalReport.DataSources.Add(rds)
Me.Show()
rv1.RefreshReport()
If my understanding is wrong, please describe your requirements in detail and provide us with details of your customized methods for reference.
Best Regards,
YongQing.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Thanks this lends a lot of clarity to solving the problem. I was wondering if you could tell me why you chose the sqldataadapter over the table adapter or is one basically the predecessor of the other? Thanks !
Member
282 Points
298 Posts
TableAdapter
Nov 12, 2019 07:57 PM|rkrex|LINK
All-Star
53711 Points
24041 Posts
Re: TableAdapter
Nov 12, 2019 08:13 PM|mgebhard|LINK
The error and method signature is very clear. The GetDataBydate does not have an overload signature that matches your calling code. Take a moments to review your custom code.
Contributor
3720 Points
1043 Posts
Re: TableAdapter
Nov 13, 2019 07:11 AM|Yongqing Yu|LINK
Hi rkrex,
According to the error message, this indicates that the actual parameter you are passing does not match the formal parameter type. In the method GetDataByDate, the first parameter is string type, while you are actually passing datatable type.
The normal working code you mentioned below, the method you call is GetDataByRegion, which is not the same as the method you have error in.
Please confirm the construction of these methods and their parameter types to ensure that the parameter types you passed in are correct.
didn't worked code:
adapter.GetDataByDate(table, batchflag, startdate, enddate)
GetDataByDate(BatchFlag As String, StartDate As Date?, EndDate As Date?)
worked code:
adapter.GetDataByRegion(table, state)
Best Regards,
YongQing.
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
282 Points
298 Posts
Re: TableAdapter
Nov 13, 2019 05:45 PM|rkrex|LINK
I'm not sure if either one of these replies are correct, but I appreciate the help. Anyway, what I discovered is that I need to use the fill method for the adapter; that's why it didn't like those arguments. For example,
Dim adapter As New DataSetTableAdapters.tbl_EmployeeTableAdapter
Dim table As New DataSet.tbl_EmployeeDataTable
adapter.FillByState(table, state)
But if you know of any good examples where someone used a table adapter with an rdlc report where they also passed multiple data parameters using a url query string, then that is what I am trying to accomplish. Thanks !!!
Contributor
3720 Points
1043 Posts
Re: TableAdapter
Nov 14, 2019 02:28 AM|Yongqing Yu|LINK
Hi rkrex,
According to your description, do you want to get the data source of the database first, then filter the data and bind it to RDLC?
Is the FillByState here your custom method?
If so, when you successfully get the data source you need, assign the data source to the corresponding ReportViewer control.
You can refer to the following code:
If my understanding is wrong, please describe your requirements in detail and provide us with details of your customized methods for reference.
Best Regards,
YongQing.
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
282 Points
298 Posts
Re: TableAdapter
Nov 14, 2019 04:33 PM|rkrex|LINK
Thanks this lends a lot of clarity to solving the problem. I was wondering if you could tell me why you chose the sqldataadapter over the table adapter or is one basically the predecessor of the other? Thanks !