ASP SQL Connection

Discussion in 'Databases' started by vktorka, Dec 16, 2009.

  1. I’m trying to open SQL connection in asp code. Trying to use the example of your code at
    http://support.Winhost.com/KB/a688/how-to-query-sql-database-with-asp-using-dsn-less-connection.aspx
    with connection string I see in my "SQL Manage" section. See below code sample:

    DIM objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "PROVIDER=SQLOLEDB;Data Source=***;Initial Catalog=***;User ID=***;Password=***;Integrated Security=False,"

    The following error has been generated:

    Provider error '80040e21'
    Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

    Any idea what is wrong? Can anyone post an example of asp code that works?
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    Try updating the connection string with this line.

    cnnSimple.Open "Provider=SQLOLEDB;Data Source=YOURDBSERVER;" _
    & "Initial Catalog=YOURDBNAME;User Id=YOURUSERID;Password=YOURPASSWORD;" _
    & "Connect Timeout=15;Network Library=dbmssocn;"
     
  3. Adding "Connect Timeout=15;Network Library=dbmssocn;" instead of "Integrated Security=False," generates following error:

    Microsoft OLE DB Provider for SQL Server error '80004005'

    [DBNETLIB][ConnectionOpen (Connect()).]Specified SQL server not found.
     
  4. Ray

    Ray

    What are you putting down for the SQL server?
     
  5. Data Source=tcp:s01.Winhost.com
     
    Last edited by a moderator: Oct 14, 2015
  6. Ray

    Ray

    Is the application on your computer or have you uploaded it on the server. This error can be misleading. The error typically means that it cannot connect to the SQL server. Usually when I see this port 1433 or 14330 is being blocked.
     
  7. I was able to make SQL server registration and to connect to SQl with Microsoft SQL management Studio on my home comuter. So, I assume 1433 and 14330 should be ok.
     
  8. Ray

    Ray

    Try deleting the tcp: from 'tcp:s01.Winhost.com'
     
    Last edited by a moderator: Oct 14, 2015
  9. No Changes
     
  10. Ray

    Ray

    I tested your site, and uploaded a file called testdbWinhost.asp to your root. I used your connection string info and I was able to connect to your database.

    Try looking at this link.

    futures-emini-trading.com/testdbWinhost.asp

    You can see that it was able to connect. You can download this file on your computer and review the connection string I created. You should be able to use this for your application.
     
    Last edited by a moderator: Oct 14, 2015
  11. thanks, it works without "tcp:" in connection string
     
  12. Ray

    Ray

    Thanks for the update. I'll have our systems administrator look into this. It should work with the tcp: in front of the server name, but if it doesn't then we'll need to modify our documentation.
     

Share This Page