I am a bit confused and having repeatedly checked that i am following insutrctuons, I have been following this link http://www.dotnetheaven.com/article/...-wcf-in-vb.net to create a WCF service to expose a dataset.
This is the error I cant seemto get around
Error 1 Class 'Service1' must implement 'Function display() As System.Data.DataSet' for interface 'IService1'. C:\Users\Administrator\Documents\Visual Studio 2010\Projects\wfcTestProject\wfcTestProject\Service1.vb 5 16 wfcTestProject
This is my IService1.vb
This is the Service1.vb
I'm really stuck so any advice or pointers greatfully received.
This is the error I cant seemto get around
Quote:
Error 1 Class 'Service1' must implement 'Function display() As System.Data.DataSet' for interface 'IService1'. C:\Users\Administrator\Documents\Visual Studio 2010\Projects\wfcTestProject\wfcTestProject\Service1.vb 5 16 wfcTestProject
Code:
' NOTE: You can use the "Rename" command on the context menu to change the interface name "IService1" in both code and config file together.
<ServiceContract()>
Public Interface IService1
<OperationContract()>
Function GetData(ByVal value As String) As String
<OperationContract()>
Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType
<OperationContract()> _
Function display() As DataSet
' TODO: Add your service operations here
End Interface
' Use a data contract as illustrated in the sample below to add composite types to service operations
<DataContract()>
Public Class CompositeType
<DataMember()>
Public Property BoolValue() As Boolean
<DataMember()>
Public Property StringValue() As String
End Class
Code:
Imports System.Data.SqlClient
' NOTE: You can use the "Rename" command on the context menu to change the class name "Service1" in both code and config file together.
Public Class Service1
Implements IService1
Public Function GetData(ByVal value As String) As String Implements IService1.GetData
Return String.Format("You entered: {0}", value)
End Function
Public Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType Implements IService1.GetDataUsingDataContract
If composite Is Nothing Then
Throw New ArgumentNullException("composite")
End If
If composite.BoolValue Then
composite.StringValue &= "Suffix"
End If
Return composite
End Function
Public Function display() As DataSet
Dim con As New SqlConnection("Data Source=Server\instance;Initial Catalog=database;Integrated Security=True;")
Dim dr As New SqlDataAdapter("select * from databaseview", con)
Dim ds As New DataSet()
dr.Fill(ds)
Return ds
End Function
End Class