ASP Data Source Connection Help

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default ASP Data Source Connection Help

    I am trying to create a connection in my ASP page to a SQL Server
    database. This is my code for the connection string:

    <%Option Explicit%>
    <%
    Dim conn
    Dim ConnectionString
    Dim RsList

    Set conn = New ADODB.Connection
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.ConnectionString = "Driver={SQL Server};" & _
    "Server=HOEALG01;" & _
    "Database=Tool;" & _
    "Uid=tool;" & _
    "Pwd=tool;" &_
    conn.Open

    .....%>

    I get the following error when I run the page.

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'ADODB'

    /gasmktbest/Scripts/Submit.asp, line 26


    Any ideas?
    KLAU Guest

  2. Similar Questions and Discussions

    1. Data Source Connection Verification Fails
      I have been trying for hours to get Cold Fusion admnistrator to accept my data souce. I am using SQL Server 2000 on my development computer. Databse...
    2. Connection to data source error
      Hi, For the past week I am continually getting disconnected from my data source in cold fusion, and have to reconnect. But when I go to do that,...
    3. Data Source Connection Problems -- CF6 and CF7
      We have doing development locally running CF6 on a local XP SP2 machine with the latest version of the MS MSDE server. When we installed CF6 last...
    4. DB Connection Error: Data source name not found
      Hei, I am using Dreamweaver MX 6.1, XP SP2 and trying to connect to a MS Access db. I can open & preview the page & data correctly using IIS...
    5. connect to the data source with or without Connection object
      To connect the ASP application to data source, we can use ADO.Connection object Const connectionString = "Provider=Microsoft.Jet.OLEDB.3.51; Data...
  3. #2

    Default Re: ASP Data Source Connection Help

    You're attempting to use VB code in VBScript. Try:

    Set conn = CreateObject("ADODB.Connection")

    Oh, wait, you already have that. Drop the line with the "New
    ADODB.Connection." Even in VB, you shouldn't use that line, as it'll create
    an unnecessary object before it needs to exist.

    Also, you may want to switch to an OLEDB connection. Take a look at
    [url]http://www.connectionstrings.com/[/url].

    Ray at work

    "KLAU" <karen.lau@mail.utexas.edu> wrote in message
    news:5733cc1a.0311040659.15371d35@posting.google.c om...
    > I am trying to create a connection in my ASP page to a SQL Server
    > database. This is my code for the connection string:
    >
    > <%Option Explicit%>
    > <%
    > Dim conn
    > Dim ConnectionString
    > Dim RsList
    >
    > Set conn = New ADODB.Connection
    > Set conn = Server.CreateObject("ADODB.Connection")
    > conn.ConnectionString = "Driver={SQL Server};" & _
    > "Server=HOEALG01;" & _
    > "Database=Tool;" & _
    > "Uid=tool;" & _
    > "Pwd=tool;" &_
    > conn.Open
    >
    > ....%>
    >
    > I get the following error when I run the page.
    >
    > Microsoft VBScript runtime error '800a01f4'
    >
    > Variable is undefined: 'ADODB'
    >
    > /gasmktbest/Scripts/Submit.asp, line 26
    >
    >
    > Any ideas?

    Ray at Guest

  4. #3

    Default Re: ASP Data Source Connection Help

    Thanks Ray.

    I tried what you said by dropping the conn as New ADODB.Connection and
    changing to a OLE DB connection string. This is my code:

    Set conn = Server.CreateObject("ADODB.Connection")
    conn.ConnectionString = "Provider=sqloledb;Data
    Source=HOEALG01\Tool;Initial Catalog=pubs;User Id=tool;Password=tool;"
    conn.Open

    It returns an error:
    Microsoft OLE DB Provider for SQL Server error '80004005'

    [DBMSSOCN]General network error. Check your network documentation.

    /gasmktbest/Scripts/Submit.asp, line 33

    What does this mean?

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Karen Lau Guest

  5. #4

    Default Re: ASP Data Source Connection Help

    Heh. It means there was a general network error. ;] Can you ping the SQL
    server from this computer? Can you connect to this SQL server from this
    machine using query analyzer or osql? Is the server behind a firewall? Are
    you using the default port for SQL? Is it open?

    Ray at work

    "Karen Lau" <karen.lau@mail.utexas.edu> wrote in message
    news:%23WXZ8gvoDHA.2820@TK2MSFTNGP10.phx.gbl...
    > Thanks Ray.
    >
    > I tried what you said by dropping the conn as New ADODB.Connection and
    > changing to a OLE DB connection string. This is my code:
    >
    > Set conn = Server.CreateObject("ADODB.Connection")
    > conn.ConnectionString = "Provider=sqloledb;Data
    > Source=HOEALG01\Tool;Initial Catalog=pubs;User Id=tool;Password=tool;"
    > conn.Open
    >
    > It returns an error:
    > Microsoft OLE DB Provider for SQL Server error '80004005'
    >
    > [DBMSSOCN]General network error. Check your network documentation.
    >
    > /gasmktbest/Scripts/Submit.asp, line 33
    >
    > What does this mean?
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  6. #5

    Default Re: ASP Data Source Connection Help

    Thanks Ray!

    Unfortunately I still get an error after your directions. Here's my
    changed code:

    Set conn = Server.CreateObject("ADODB.Connection")
    conn.ConnectionString = "Provider=sqloledb;Data
    Source=HOEALG01\Tool;Initial Catalog=pubs;User Id=tool;Password=tool;"
    conn.Open

    Heres the error:

    Microsoft OLE DB Provider for SQL Server error '80004005'

    [DBMSSOCN]General network error. Check your network documentation.

    /gasmktbest/Scripts/Submit.asp, line 33


    Any ideas?

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Karen Lau Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139