#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    13
    Rep Power
    0

    Open connection with SQL server


    hello

    I use ASP.NET with SQL server 2000, hava a problem when I try to open the connection to my database which is in a sql server 2000


    The Error is:
    Server Error in '/TrainingSystem' Application.
    --------------------------------------------------------------------------------

    Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

    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: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

    Source Error:


    Line 24: Private Sub OpenConnection()
    Line 25: Cn = New SqlConnection(ConfigurationSettings.AppSettings("OpenDB"))
    Line 26: Cn.Open()
    Line 27: 'Try
    Line 28: ' Cn.Open()

    ---------------------------------------------------------
    I am using ASP.Net with VB script


    This code is on the web.config file

    <appSettings>
    <add key="OpenDB" value="Server=localhost;uid=sa;pwd=;database=TSdatabase;"></add>
    <!-- DYNAMIC INTRANET SETTING Set IsIntranet value="true" to insert is Student option in user Administration -->
    <add key="isIntranet" value="false"></add>
    </appSettings>


    On the VB file I have this code:

    Public Cn As New SqlConnection()

    Private Sub OpenConnection()
    Cn = New SqlConnection(ConfigurationSettings.AppSettings("OpenDB"))
    Cn.Open()
    End Sup

    and I call it in the sub Page_Load

    Thx

    Pls help me
    I can not Find the error
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Canada - Egypt
    Posts
    60
    Rep Power
    12
    I hope this is of any help to anyone.

    Yassoor
    http://www.WebsitesCreation.ca
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    13
    Rep Power
    0

    thx


    Thx

    I found the error I had check one option to one options in the SQL sercer, to be the user able, to use the server not only the window.

IMN logo majestic logo threadwatch logo seochat tools logo