Overload resolution failed
I have a vb.net function that expects 2 parameters - example :
GetCustomer(byval Addr1 as string, byval Addr2 as string).
The calling program calls this function by passing 2 string variables,example:
myCustomer = GetCustomer(strAddr1, strAddr2)
The function works well when both strAddr1 and strAddr2 have string values. However, sometimes strAddr2 is NULL. In that case, when the function is called, I get an error: Overload resolution failed because no Public 'GetCustomer' is most specific for these arguments..
These are just examples from a more complex requirement, but the parameters being passed may be nulls, string or integers and one function needs to handle them all without creating multiple overloaded copies.
Thanks.
Re: Overload resolution failed
You missed one small step when setting up the databindings for the viewer.
You correctly went into the DataBindings dialog box and selected the cached report. HOWEVER, on the left hand side of the dialog box, you should have first selected the property "ReportSource". Instead, you left it at the default property AccessKey. This results in the databindings trying to assign the cached report to the AccessKey property instead of the ReportSource property.
Once you fix that, you should be good to go!
Re: Overload resolution failed
Hi,
I can provide you some sort of code here.
You don't need to use Session to save the object, such as DataSet, in page. For example, you use the following code to call the stored procedure:
Code:
Public Sub SelectCustomer()
Dim connection As SqlConnection = _
New SqlConnection(connectionString)
connection.Open()
Try
Dim command As SqlCommand = _
New SqlCommand("SelectCustomer", _ connection)
command.Parameters.Add("@CustomerID", "PAULK")
command.CommandType = CommandType.StoredProcedure
Dim adapter As SqlDataAdapter = New SqlDataAdapter(command)
Dim table As DataTable = New DataTable
adapter.Fill(table)
Catch ex As Exception
Console.WriteLine(ex.Message)
Throw
Finally
connection.Close()
End Try
End Sub