Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / February 2007

Tip: Looking for answers? Try searching our database.

creating a webservice

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hector - 14 Feb 2007 21:46 GMT
Sorry if this is a little off topic but I have a question related to Infopath
form.

I am using web matrix to create a web service (asmx) file using VB and when
I use Firefox or Explorer I am able to access the web service but not run any
connections to the database unless I press F5 ( creating an 8080 virtual
port) on my local XP machine running the web server. I already tried moving
the asmx file to another server running IIS and the same result. I am not
sure what's causing this.

Do I need to create the DLL compile the source code and place the DLL inside
the BIN directory?

Here's the code from the file:

<%@ WebService language="VB" class="studentinfo" %>

Imports System
IMPORTS SYSTEM.DATA
Imports System.Web.Services
Imports System.Xml.Serialization

Public Class studentinfo

   <WebMethod> Public Function Add(a As Integer, b As Integer) As Integer
       Return a + b

   End Function

<WebMethod()> Public Function GetProfile( Studentid As long) As DataSet

       Dim dstProducts As Data.DataSet
       Dim connectionString As String = "server='server123';
trusted_connection=true; database='thedb'"
       Dim dbConnection As System.Data.IDbConnection = New
System.Data.SqlClient.SqlConnection(connectionString)

       Dim queryString As String = "SELECT [FIRST_NAME], [LAST_NAME],
[MIDDLE_NAME], [STUDENT from xyz where id =12344555"
       Dim dbCommand As System.Data.IDbCommand = New
System.Data.SqlClient.SqlCommand
       dbCommand.CommandText = queryString
       dbCommand.Connection = dbConnection

       Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.SqlClient.SqlDataAdapter
       dataAdapter.SelectCommand = dbCommand
       Dim dataSet As System.Data.DataSet = New System.Data.DataSet
       dataAdapter.Fill(dataSet)

       Return dataSet

End Function
End Class

BTW:  the ADD function works fine. ;-)

This is the error when I try the GETPROFILE:
System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason:
Not associated with a trusted SQL Server connection.
  at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
  at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
S.Y.M. Wong-A-Ton - 15 Feb 2007 06:48 GMT
So how does this relate to InfoPath? You could have asked your question in
one of the .NET development newsgroups.

A few things to check:
1. Verify that your connection string is correct. For a list of possible
valid connection strings, go here: http://www.connectionstrings.com
2. What is the authentication being used on your SQL Server? Windows
Integrated? SQL? Or mixed? Since you're using a trusted connection, .NET is
expecting the authentication to be Windows Integrated. If you're using SQL
authentication, specify a valid username/password for the connection. Also
grant the user access to SQL Server as well as the database being accessed.
---
S.Y.M. Wong-A-Ton

> Sorry if this is a little off topic but I have a question related to Infopath
> form.
[quoted text clipped - 61 lines]
> System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
> stateObj)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.