connect to sql server in different pc (sql server 2003 vs 2005) [Answered]RSS

2 replies

Last post Apr 24, 2012 05:24 AM by Lloydz

  • connect to sql server in different pc (sql server 2003 vs 2005)

    Apr 18, 2012 09:58 PM|-_-|LINK

    Set Session("conn")=Server.CreateObject("ADODB.Connection")

        session("sqlServer")="server_name"
        Session("DB_Name") = "dbName"
        Session("connStr")="Provider=SQLOLEDB;server=" + session("sqlServer") + "; database=" + session("DB_Name") +";User Id=sa;Password='user'"
      
        
       
        Session("conn").open session("connStr")
     
     ----------------


    if request.QueryString("action")= "search" then
        'Get User Info
        strsql="exec SearchInfo @id='" & UCASE(trim(request("txtuserid")))
         
           
            set rs1 = CreateObject("ADODB.Recordset")
                                                         
             rs1.Open strsql, session("conn"), 1, 3        <---can't get record in sql server 2003 but ok in sql server 2005
          
    ==============================================================================

          
    why i always can't get any record from ASP web page. but why i exec in sql server directly, it is ok ,retruns many records.


     


     

  • Re: connect to sql server in different pc (sql server 2003 vs 2005)

    Apr 24, 2012 02:15 AM|necro_mancer|LINK

    hi there,

    if your ASP page does not return any result, does it return any error message? I guess the issue is with the connection string. Can your ASP page actually find your database that is located on a different system?


  • Re: connect to sql server in different pc (sql server 2003 vs 2005)

    Apr 24, 2012 05:24 AM|Lloydz|LINK

    To add to what above already said, you can debug your classic asp application to retrieve more detailed error inforamtion. You can take referece to the following thread:

    http://forums.iis.net/t/1155087.aspx

    Also failed request tracing will show more clues on this issue:

    Using Failed Request Tracing to troubleshoot Classic ASP errors
    http://learn.iis.net/page.aspx/565/using-failed-request-tracing-to-troubleshoot-classic-asp-errors/

    Thanks.