Results 1 to 2 of 2

Thread: Can't fill dataset from SQLserver on another PC. It's got me well confused.

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Can't fill dataset from SQLserver on another PC. It's got me well confused.

    1stly here's the error I am getting
    SQL Server does not exist or access denied.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

    Source Error:


    Line 8: Dim Adapter As New SqlDataAdapter(SQL, Conn)
    Line 9: Dim DS As New DataSet
    Line 10: Adapter.Fill(DS)
    Line 11: Return DS
    Line 12: End Function
    Now this isn't as straight off as it sounds.
    My Function is:
    VB Code:
    1. Public Function GetDataSet(ByVal SQL As String) As DataSet
    2.         Dim Conn As New SqlConnection(CONN_STRING)
    3.         Dim Adapter As New SqlDataAdapter(SQL, Conn)
    4.         Dim DS As New DataSet
    5.         Adapter.Fill(DS)
    6.         Return DS
    7.     End Function
    Now I have 2 connection strings. 1 for my local SQL server, and one for the remote one. This look like:
    VB Code:
    1. Private Const CONN_STRING As String = "Password=woof;Persist Security Info=True;User ID=sa;Initial Catalog=BadgerWeb;Data Source=DBSERVER"
    Now if I add:
    Code:
    Provider=SQLOLEDB.1;
    To the front of this conn string then it works for ado in VB6.
    OK. Now the error I am getting is on the Fill method.
    This ONLY occurs when I try to get data using .NET AND the SQL Server on another PC.
    If I use VB6, and the same modified conn string, and access data on the SQL Server on another PC then it works.
    It's ONLY a problem with .NET

    Woof

  2. #2

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Sorry, this is from an ASP.NET Web Form. In the web.config file there is:
    Code:
    <sessionState 
                mode="InProc"
                stateConnectionString="tcpip=127.0.0.1:42424"
                sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
                cookieless="false" 
                timeout="20"
    That doesn't have anything to do with it does it?

    Woka

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width