Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Microsoft VBScript runtime (0x800A01A8)

    Error Type:
    Microsoft VBScript runtime (0x800A01A8)
    Object required: ''
    /usertest.asp, line 19

    I am getting the above error. Can anyone help me whats wrong with this. I am using xp professional and IIS. I am new to programing. I created a dsnn and connected it to the database as well. Please help! The entire code is below.

    <%@language = VBScript%>
    <option explicit>
    <!--#include file="adovbs.inc"-->
    <HTML>
    <BODY>
    <% ' reading the user infoormation from the mylaptoptest.htm %>
    <%
    dim strUser, strpswd
    struser = userName
    strpswd = userpswd

    'to connect to db you must first create the connection and recordset object
    ' and then connect it to the appropriate db

    dim objConn
    set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString = "DSN = userinfo.dsn"

    objConn.Open

    'create a recordset object instance and retrieve the information
    'from the userinfotable

    Dim objRs
    set objRs = Server.CreateObject("ADODB.Recordset")
    objRs.Open "loginfo",objConn,,,adCmdTable


    'check the content of the table

    Do While Not objRs.EOF
    if strUser = objRs.txtUser then
    if strpswd = objRs.txtpswd then
    Response.write " Welcome" & struser & " you have entered the right user and pswd"

    Else
    Response.write ("please enter the right pswd")
    End If
    Else
    Response.write ("Please enter valid username")

    End If

    objRs.MoveNext

    Loop


    objRs.Close
    set objRs = Nothing

    objConn.Close
    set objConn = Nothing
    %>
    </BODY>

  • #2
    New Coder
    Join Date
    Apr 2008
    Posts
    39
    Thanks
    6
    Thanked 0 Times in 0 Posts
    hi,

    the error part Object required: '' tells us that the connection is not being made to the database, as there is an object required - ie the database - so that is where the error is.

    Code:
    objConn.ConnectionString = "DSN = userinfo.dsn" will be the line that is upsetting your code.
    Try this
    Code:
    dim objConn
    set objConn = Server.CreateObject("ADODB.Connection")
    
    'objConn.ConnectionString = "DSN = userinfo.dsn" ' comment out this and try the line below
    
    objConn.Open("userinfo") ' if userinfo is the name of your DSN connection else put the name of your DSN in place of userinfo in the string
    
    'objConn.Open ' comment out this one as it is in the above line
    http://www.connectionstrings.com/ is a page that will show you different connections strings depending on your database and not using DSN which does make things easier. There are also sample DSN connection strings.

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Location
    SE Wisconsin, US
    Posts
    222
    Thanks
    1
    Thanked 20 Times in 20 Posts
    http://www.connectionstrings.com is an awesome resource. Their tools work like a charm for all sorts of databases!


  •  

    Posting Permissions

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