I have attached WCF service to my sample website.
WCF functions work fine except one which use SQL query to get data from SQL server.
I'm not very familiar with VB.NET, my experience comes from VBA, it's similar but setting query is quite different.
At first I tried to use SqlDataReader
then SqlDataAdapter
- The same results. My Service has stuck.
Visual Studio shows error that SQL Server can't pass data because there is an internal error.
This is strange because when I use "WCF Test Client" in Visual Studio, then both functions work good and receive correct data. Also when I have attached this functions directly to my website also worked good. The problem is using them by WCF.
Below is my function with SQLDataAdapter
Public Function GetCookiesPriceDS(ByVal nameOfCookie As String) _
As DataSet Implements IService1.GetCookiesPriceDS
Dim queryString As String
Dim dataSet As DataSet = New DataSet("temporary")
queryString = "select CookiesPrice from " &
"tblCookies where CookiesName='" & nameOfCookie & "'"
Using connection As New SqlConnection _
("Server= xyz\SQLEXPRESS; Database = Cookies2; " &
"Integrated Security = true;User Id = xyz;Password = xyz")
Dim adapter As New SqlDataAdapter()
adapter.SelectCommand = New SqlCommand(queryString, connection)
adapter.Fill(dataSet)
Return dataSet
End Using
End Function