Problem retrieving data from SQL Server

Discussion in 'ASP .Net Web Services' started by Altman, Apr 27, 2005.

  1. Altman

    Altman Guest

    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
    Altman, Apr 27, 2005
    #1
    1. Advertising

  2. 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/d...mdatasqlclientsqlconnectionclassopentopic.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?
    Knut-Olav Traa, May 2, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arlyn
    Replies:
    1
    Views:
    2,277
    Steve C. Orr [MVP, MCSD]
    May 13, 2005
  2. =?Utf-8?B?RGF2ZQ==?=

    Retrieving word docs stored in sql server?

    =?Utf-8?B?RGF2ZQ==?=, Jan 15, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    407
    =?Utf-8?B?RWx0b24gVw==?=
    Jan 16, 2006
  3. Roy Huxley

    Retrieving data from SQL Server

    Roy Huxley, Oct 8, 2003, in forum: Java
    Replies:
    4
    Views:
    481
    Thomas Kellerer
    Oct 10, 2003
  4. nkunapa
    Replies:
    4
    Views:
    6,709
    nkunapa
    Aug 10, 2005
  5. Prasad
    Replies:
    2
    Views:
    315
    Munna
    May 27, 2008
Loading...

Share This Page