SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New to ASP classic, need help connecting to sql-database and output

    Hey.

    I have a client who needs an ASP-script that just connects to the database and outputs the contents.

    This is easy for me in PHP but I'm new to classic ASP and although I've read tutorials I'm having trouble connecting.

    This is the last connect-script I've tried:

    Code:
    Code ASP:
    <%
    dim con, Rs
    set con=server.CreateObject("adodb.connection")
    con.Open "Provider=sqloledb;SERVER=localhost;DATABASE=database_name;UID=username ;PWD=password;"
    set Rs=server.CreateObject("adodb.recordset")
     
    %>
    It only gives me:

    Microsoft OLE DB Provider for SQL Server error '80004005'

    [DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection.

    test.asp, line 4


    So I need help with this, how to connect and how to test it. In other words, when connected, I need help outputting for example the contents in table "Title"

    Many thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    Con.Open "Provider=sqloledb;Data Source=(local);Initial Catalog=databaseName;User Id=username;Password=password;"





    Which version of SQL Server are you using ?

  3. #3
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MSSQL2008. I solved it. Thanks.


Bookmarks

Posting Permissions

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