cbasulto
asked on
Object reference not set to an instance of an object : Web Method
Hello,
Getting the error "Object reference not set to an instance of an object" from the following code. Any ideas?
<WebMethod()> Public Function UserDisplayName(ByVal strLogin As String)
Dim ds As DataSet
Dim row As DataRow
Dim DisplayName As String
ds.Merge(GetEmployees(0, 0, strLogin))
row = ds.Tables("Employees").Row s(0)
If ds.Tables("Employees").Row s.Count = 1 Then
DisplayName = row("FirstName") & " " & row("LastName")
Return DisplayName
Else
Return "Invalid"
End If
End Function
Getting the error "Object reference not set to an instance of an object" from the following code. Any ideas?
<WebMethod()> Public Function UserDisplayName(ByVal strLogin As String)
Dim ds As DataSet
Dim row As DataRow
Dim DisplayName As String
ds.Merge(GetEmployees(0, 0, strLogin))
row = ds.Tables("Employees").Row
If ds.Tables("Employees").Row
DisplayName = row("FirstName") & " " & row("LastName")
Return DisplayName
Else
Return "Invalid"
End If
End Function
ASKER
Still same error with:
<WebMethod()> Public Function UserDisplayName(ByVal strLogin As String) As String...
<WebMethod()> Public Function UserDisplayName(ByVal strLogin As String) As String...
ASKER
I have identified where the reference error is occurring;
ds.Merge(GetEmployees(0, 0, strLogin))
The GetEmployees function is another webmethod in the same service that fetches a dataset with records filtered by input parameters.
ds.Merge(GetEmployees(0, 0, strLogin))
The GetEmployees function is another webmethod in the same service that fetches a dataset with records filtered by input parameters.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Weddell is correct
<WebMethod()> Public Function UserDisplayName(ByVal strLogin As String) AS String