Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Problem retrieving data from SQL Server

Reply
Thread Tools

Problem retrieving data from SQL Server

 
 
Altman
Guest
Posts: n/a
 
      04-27-2005
I am a newbie to both SQL Server and webservices. I have mostly done
programing in Foxpro, VB6, and a little C++, and VB.net. I have been able
to make a simple webservice work but now I am trying to go one step further
and return XML string of a table. I am trying to return the Customer table
of the northwind database. I am creating the webservice on a XP machine and
loading it to a Win 2003 server. The error I am getting is Login failed for
user 'NT AUTHORITY/NETWORK SERVICE'. This is my function
<WebMethod()> _

Public Function GetData() As String

Dim ctest As String, custDS As New DataSet

Me.SqlConnection1.Open()

Me.CustData.Fill(custDS)

Me.SqlConnection1.Close()

ctest = custDS.GetXml()

custDS = Nothing

Return ctest

End Function

If I do the same function in a vb.net app it works, what am I doing wrong?
--
TIA

Altman



 
Reply With Quote
 
 
 
 
Knut-Olav Traa
Guest
Posts: n/a
 
      05-02-2005
Hello,

When you run the function as a vb.net app, you are accessing the db as
your own windows user (which probably have access to the database).
When the web service is trying to access the database, it uses the
user 'NT AUTHORITY/NETWORK SERVICE'.

You should create a new user in the sql server that has access to
database and specify this user in the connectionstring when creating
the sqlconnection object, like specified in:

(http://msdn.microsoft.com/library/de...sopentopic.asp)

Best regards,

Knut-Olav Traa
knut-olav.traa [AT] bekk.no

"Altman" <> wrote in message news:<>...
> I am a newbie to both SQL Server and webservices. I have mostly done
> programing in Foxpro, VB6, and a little C++, and VB.net. I have been able
> to make a simple webservice work but now I am trying to go one step further
> and return XML string of a table. I am trying to return the Customer table
> of the northwind database. I am creating the webservice on a XP machine and
> loading it to a Win 2003 server. The error I am getting is Login failed for
> user 'NT AUTHORITY/NETWORK SERVICE'. This is my function

....
>
> If I do the same function in a vb.net app it works, what am I doing wrong?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem retrieving data from Stored Procedure from SQL 2005 Prasad ASP .Net 2 05-27-2008 10:49 AM
Help. Getting a An error has occurred while establishing a connectionto the server. When connecting to SQL Server 2005, this failure may be causedby the fact that under the default settings SQL Server does not allow remote aboutjav.com@gmail.com ASP .Net 0 05-03-2008 12:43 PM
Retrieving word docs stored in sql server? =?Utf-8?B?RGF2ZQ==?= ASP .Net 1 01-16-2006 01:27 AM
uploading and retrieving data into an Sql Image field Arlyn ASP .Net 1 05-13-2005 04:39 PM
Retrieving data from SQL Server Roy Huxley Java 4 10-10-2003 06:32 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57