locked
Please help,Problem connecting SQL server using VBscript RRS feed

  • Question

  • ya, got the following error (I tested on my machine via localhost):
    Microsoft   OLE   DB   Provider   for   SQL   Server   (0x80004005)
    Login   failed   for   user   '(null)'.   Reason:   Not   associated   with   a   trusted   SQL   Server   connection.
    I have searched plenty of webpages but could not solve it, although there are a lot of friends
    getting the same problem.
    I am new to ASP, any one here can help? thanks in advance
    Code:
    Session.timeout=15
    Set   conn=Server.Createobject("ADODB.Connection")
    Set   rcdset=Server.Createobject("ADODB.Recordset")
    Conn.connectionstring   ="PROVIDER=SQLOLEDB;DATA   SOURCE=serverip;Initial   Catalog=Car;Integrated   Security=SSPI;Trusted_Connection=no"  
    conn.Open
    PS,when I use SQL   server   management   studio   express to connect the server, I am using windows authentication with no password required, while the server itself is set to mixed mode of authenticaiton.
    English not good, hope you can read.
    Friday, January 25, 2008 1:04 AM

All replies

  • Hello,

     

    I am surprised with your two code lines :

    Integrated   Security=SSPI;Trusted_Connection=no"

     

    If i'm doing a mistake  Integrated Security and Trusted_Connection are equivalent

    but  Integrated Security = SSPI ==> Windows Authentification

          Trusted_Connection = no ==> Sql Server Authentification

     

    Moreover when in a connectionstring you have more than one

    See the link

    http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbconnection.connectionstring(VS.80).aspx

    you will see :

    If a specific keyword in a keyword=value pair occurs multiple times in a connection string, the last occurrence listed is used in the value set.

    so you are in SQL Server Authentification without providing any login name and password

    It's why you have the error :   

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

     

    you have to suppress Trusted_Connection = no  and no more problem

     

    I hope that post will help you

     

    Have a nice day

    Friday, January 25, 2008 8:10 AM
  • Hello,

     

    See this link :

    http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=2730825&SiteID=1

     

    Sheng Jiang wrote  :

    Because both Integrated Security and Trusted_Connection are mapped to DBPROP_AUTH_INTEGRATED. So they are indentical. Addr, Address and Network Address map to the same SSPROP_INIT_NETWORKADDRESS setting but Data Source and Server maps to DBPROP_INIT_DATASOURCE

     

    So you haven't to mix Integrated Security and Trusted_Connection in your connection string. The last value isused for the connection

     

    Thanks to Sheng Jiang for his (her) clear explanation

     

    Have a nice day

     

    Friday, January 25, 2008 8:42 AM