SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie ASP problem

    Here is the error I'm getting:
    Code:
    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method: 'Open'
    /jesuit/Default.asp, line 12
    Now I'll post my code since it isn't very much.

    global.asa

    Code:
    <script language="VBScript" runat="Server">
    Sub Application_OnStart()
    	Dim strConn
    	strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\databases\jesuit.mdb"
    	Application("strConn")=strConn
    End Sub
    </script>
    default.asp

    Code:
    <% Option Explicit %>
    <html>
    <head>
    <title>Jesuit High School Sailing</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="includes/jesuit.css" type="text/css">
    </head>
    <% 
    
    Dim rsUpdates
    rsUpdates=Server.CreateObject("ADODB.Recordset")
    rsUpdates.Open "SELECT * FROM jesuit", Application("strConn")
    
    %>
    <body bgcolor="#FFFFFF" text="#000000">
    <p class="header">Jesuit Sailing Team</p>
    <p class="header">Updates:<p>
    
    <table cellpadding="2" cellspacing="0">
    <%
    
    Do While Not rsUpdates.EOF
    	Response.Write "<tr>"
    	Response.Write "<td class=standard>" & rsUpdates("title") & "<br>Posted by " & rsUpdates("author") & "<br>" & rsUpdates("message") & "</td>"
    	Response.Write "</tr>"
    	rsUpdates.MoveNext
    Loop
    
    rsUpdates.Close
    %>
    </table>
    
    <span class="standard">Add an update:</span><br>
    <form method="post" action="post.asp">
    	<table cellpadding="2" cellspacing="1" bgcolor="#000000">
    		<tr>
    			<td bgcolor="#FFFFFF" class="standard">Name:</td><td bgcolor="#FFFFFF"><input type="text" name="author"></td>
    		</tr>
    		<tr>
    			<td bgcolor="#FFFFFF" class="standard">Title:</td><td bgcolor="#FFFFFF"><input type="text" name="title"></td>
    		</tr>
    		<tr>
    			<td bgcolor="#FFFFFF" class="standard" valign="top">Message:</td><td bgcolor="#FFFFFF"><textarea name="message"></textarea></td>
    		</tr>
    		<tr>
    			<td bgcolor="#FFFFFF">&nbsp;</td><td bgcolor="#FFFFFF"><input type="submit" value="Post it!"></td>
    		</tr>
    	</table>
    </form>
    </body>
    </html>
    I keep getting an error on line 12 of default.asp where I try to do rsUpdates.Open.

    This is how Kevin Yank did it in his tutorial, why won't it work for me?

  2. #2
    SitePoint Guru siphilp's Avatar
    Join Date
    Nov 2001
    Location
    Fife, Scotland
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Try some thing else?

    Connecting to the database

    function objConn
    objConn = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
    "Persist Security Info=False;" &_
    "Data Source=" &Server.MapPath("Your database path .e.g databases/jesuit.mdb")
    end function


    Open connection and query

    Dim strSQL
    strSQL = "SELECT * FROM FROM jesuit"
    Dim objRS
    Set objRS = Server.createobject("ADODB.Recordset")
    objRS.Open strSQL,objConn

    Then format your out put to how you like. Does this help anyway?

    Simon Philp

  3. #3
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you trying this locally with PWS?

  4. #4
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WOW! You totally blew me away.

    What is PWS?

    I just went to Add/Remove Programs on my computer and Windows Components then added support for IIS.

    Following Kevin Yank's tutorial I created a new application under Administrative Tools.

    Then I saved that global.asa file and default.asp.

    Simon, could you explain your code a little better?

    I don't follow it at all.

  5. #5
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Snoozy,

    You might not have the JET OLEDB provider on your system. Try using an ODBC driver instead.

    Code:
    'Change
    strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\databases\jesuit.mdb"
    
    'to:
    strConn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\databases\jesuit.mdb"
    As for Simons code...

    He's created a Connection object and then used that to open the db connection. He then uses the Connection object to open the Recordset object.

    You can use ADO this way or the way you've done it by using the connection string (strConn) with the recordset rather than a Connection object.

    Under the covers ADO creates a Connection object, when you use a connection string to open a Recordset object. ADO creates the Connection object quicker than if a separate Connection object is created and opened in script.

    The down side is that this Connection object can't be re-used by another section of script. Also, any db errors will populate the Connection object's error collection which wouldn't be accessible either.

    The Server.MapPath method returns an absolute path of a file for the virtual path parameter. This makes moving your site is easier as your connection string isn't hard coded. The Server.MapPath method is fairly resource intensive though.

  6. #6
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool, thanks

  7. #7
    SitePoint Guru siphilp's Avatar
    Join Date
    Nov 2001
    Location
    Fife, Scotland
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Request for advice

    Morning,
    There are many people here who would happily show you the right direction. If you come across any more snags / problems or would like something explained post it, or pm some one.

    Best regards


    Si Philp

  8. #8
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That doesn't help! My error comes on line 12:

    Code:
    rsUpdates.Open "SELECT * FROM jesuit", Application("strConn")
    Here is what it says:
    Code:
    Object doesn't support this property or method: 'Open'
    I guess I can't "Open" the result set.

  9. #9
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    [code]
    <% Option Explicit %>
    <html>
    <head>
    <title>Jesuit High School Sailing</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="includes/jesuit.css" type="text/css">
    </head>
    <%

    Dim rsUpdates
    Set rsUpdates=Server.CreateObject("ADODB.Recordset")
    rsUpdates.Open "SELECT * FROM jesuit", Application("strConn")

    %>
    <body bgcolor="#FFFFFF" text="#000000">
    <p class="header">Jesuit Sailing Team</p>
    <p class="header">Updatesp>

    <table cellpadding="2" cellspacing="0">
    <%

    Do While Not rsUpdates.EOF
    Response.Write "<tr>"
    Response.Write "<td class=standard>" & rsUpdates("title") & "<br>Posted by " & rsUpdates("author") & "<br>" & rsUpdates("message") & "</td>"
    Response.Write "</tr>"
    rsUpdates.MoveNext
    Loop

    rsUpdates.Close
    %>
    </table>

    <span class="standard">Add an update/span><br>
    <form method="post" action="post.asp">
    <table cellpadding="2" cellspacing="1" bgcolor="#000000">
    <tr>
    <td bgcolor="#FFFFFF" class="standard">Name/td><td bgcolor="#FFFFFF"><input type="text" name="author"></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF" class="standard">Title/td><td bgcolor="#FFFFFF"><input type="text" name="title"></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF" class="standard" valign="top">Message/td><td bgcolor="#FFFFFF"><textarea name="message"></textarea></td>
    </tr>
    <tr>
    <td bgcolor="#FFFFFF"> </td><td bgcolor="#FFFFFF"><input type="submit" value="Post it!"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  10. #10
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I will as soon as I get home, mind indicating what you changed?

  11. #11
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Snoozy,

    If D's suggestion doesn't work can you try the following to see if you can open a connection to the db?

    Could you also do a search of your system for the files msado*.dll and have a look at the version number you're using? (Right click > Properties | Version)

    *** D, what have you changed?



    Code:
    <%@ Language="VBScript" %>
    <%
    	Option Explicit
    	
    	Dim DBCONNSTR
    	
    	DBCONNSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\databases\jesuit.mdb"
    	
    	Function CheckConnection()
    		
    		On Error Resume Next
    		
    		Dim objConn
    		Dim objError
    			
    		Set objConn = Server.CreateObject("ADODB.Connection")
    		
    		If Err.Number <> 0 Then
    			Response.Write "<p>Error creating Connection object.</p>" & vbCrLf
    			Response.Write "<p>Number: " & Err.Number & "<br>" & vbCrLf
    			Response.Write "Source: " & Err.Source & "<br>" & vbCrLf
    			Response.Write "Description: " & Err.Description & "</p>" & vbCrLf
    		Else
    			
    			objConn.Open DBCONNSTR
    			
    			'Check to see if we got any errors. If so, then display them
    			If objConn.Errors.Count > 0 Then
    				Response.Write "<p>Error opening connection</p>" & vbCrLf
    				
    				For Each objError In objConn.Errors
    
    					Response.Write "<p>Number: " & objError.Number & "<br>" & vbCrLf
    					Response.Write "NativeError: " & objError.NativeError & "<br>" & vbCrLf
    					Response.Write "Source: " & objError.Source & "<br>" & vbCrLf
    					Response.Write "Description: " & objError.Description & "</p>" & vbCrLf
    				
    				Next
    			Else
    				Response.Write "<p>Opened connection ok.</p>" & vbCrLf
    				Response.Write "<p>Closing connection</p>" & vbCrLf
    				
    				objConn.Close
    			End If
    			
    			'Destroy Connection object
    			Set objConn = Nothing
    		End If
    		
    		
    	End Function
    
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
    	<title>Check connection</title>
    </head>
    
    <body>
    <% CheckConnection %>
    
    
    </body>
    </html>

  12. #12
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    You're all overlooking the simple things. In default.asp, you haven't declared rsUpdates as an object using the set keyword. Change the lines to look like this:

    Dim rsUpdates
    SET rsUpdates=Server.CreateObject("ADODB.Recordset")
    rsUpdates.Open "SELECT * FROM jesuit", Application("strConn")

    That should work now!
    SiteTell.com: Get the best viral marketing tool on the planet and watch as the number of unique visitors to your site soars!

  13. #13
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Slaps self about head.

    Now I see what D changed.

  14. #14
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol its always the dumb errors.

  15. #15
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, D's code doesn't work.

    Here is the error I get with that:
    Code:
    Technical Information (for support personnel)
    
    Error Type:
    ADODB.Recordset (0x800A0BB9)
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
    /jesuit/default.asp, line 12
    
    
    Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461) 
    
    Page:
    GET /jesuit/default.asp
    Here is the error I get with Shane's:

    Code:
    Error opening connection
    
    Number: 0
    NativeError: 249761507
    Source: Microsoft JET Database Engine
    Description
    As for those version numbers:

    msado15.dll
    msadomd.dll
    smador15.dll
    msadox.dll

    2.70.7713.0

    They are all that.

  16. #16
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Arrrgh, stoopid recordsets, I hate them, try this:
    Code:
    <html> 
    <head> 
    <title>Jesuit High School Sailing</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    <link rel="stylesheet" href="includes/jesuit.css" type="text/css"> 
    </head> 
    <% 
    
    Dim rsUpdates 
    Set rsUpdates=Server.CreateObject("ADODB.Connection") 
    rsUpdates.Open Application("strConn") 
    Set getStuff = rsUpdates.Execute("SELECT * FROM jesuit")
    %> 
    <body bgcolor="#FFFFFF" text="#000000"> 
    <p class="header">Jesuit Sailing Team</p> 
    <p class="header">Updates:<p> 
    
    <table cellpadding="2" cellspacing="0"> 
    <% 
    
    Do While Not getStuff.EOF 
    Response.Write "<tr>" 
    Response.Write "<td class=standard>" & getStuff("title") & "<br>Posted by " & getStuff("author") & "<br>" & getStuff("message") & "</td>" 
    Response.Write "</tr>" 
    getStuff.MoveNext 
    Loop 
    %> 
    </table> 
    
    <span class="standard">Add an update:</span><br> 
    <form method="post" action="post.asp"> 
    <table cellpadding="2" cellspacing="1" bgcolor="#000000"> 
    <tr> 
    <td bgcolor="#FFFFFF" class="standard">Name:</td><td bgcolor="#FFFFFF"><input type="text" name="author"></td> 
    </tr> 
    <tr> 
    <td bgcolor="#FFFFFF" class="standard">Title:</td><td bgcolor="#FFFFFF"><input type="text" name="title"></td> 
    </tr> 
    <tr> 
    <td bgcolor="#FFFFFF" class="standard" valign="top">Message:</td><td bgcolor="#FFFFFF"><textarea name="message"></textarea></td> 
    </tr> 
    <tr> 
    <td bgcolor="#FFFFFF"> </td><td bgcolor="#FFFFFF"><input type="submit" value="Post it!"></td> 
    </tr> 
    </table> 
    </form> 
    </body> 
    </html>

  17. #17
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I don't want to depend on the global.asa file yet so I too the application On start thingie out.

    Here is all the code I've got so far:

    Code:
    <% Option Explicit %> 
    <html> 
    <head> 
    <title>Jesuit High School Sailing</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    <link rel="stylesheet" href="includes/jesuit.css" type="text/css"> 
    </head> 
    <% 
    
    Dim strConn
    strConn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\databases\jesuit.mdb"
    Dim rsUpdates 
    Set rsUpdates=Server.CreateObject("ADODB.Recordset") 
    rsUpdates.Open "SELECT * FROM jesuit", strConn 
    
    %> 
    <body bgcolor="#FFFFFF" text="#000000"> 
    <p class="header">Jesuit Sailing Team</p> 
    <p class="header">Updates:<p> 
    
    <table cellpadding="2" cellspacing="0"> 
    <% 
    
    Do While Not rsUpdates.EOF 
    Response.Write "<tr>" 
    Response.Write "<td class=standard>" & rsUpdates("title") & "<br>Posted by " & rsUpdates("author") & "<br>" & rsUpdates("message") & "</td>" 
    Response.Write "</tr>" 
    rsUpdates.MoveNext 
    Loop 
    
    rsUpdates.Close 
    %> 
    </table> 
    
    <span class="standard">Add an update:</span><br> 
    <form method="post" action="post.asp"> 
    <table cellpadding="2" cellspacing="1" bgcolor="#000000"> 
    <tr> 
    <td bgcolor="#FFFFFF" class="standard">Name:</td><td bgcolor="#FFFFFF"><input type="text" name="author"></td> 
    </tr> 
    <tr> 
    <td bgcolor="#FFFFFF" class="standard">Title:</td><td bgcolor="#FFFFFF"><input type="text" name="title"></td> 
    </tr> 
    <tr> 
    <td bgcolor="#FFFFFF" class="standard" valign="top">Message:</td><td bgcolor="#FFFFFF"><textarea name="message"></textarea></td> 
    </tr> 
    <tr> 
    <td bgcolor="#FFFFFF"> </td><td bgcolor="#FFFFFF"><input type="submit" value="Post it!"></td> 
    </tr> 
    </table> 
    </form> 
    </body> 
    </html>

  18. #18
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    /jesuit/default.asp, line 11
    
    
    Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461) 
    
    Page:
    GET /jesuit/default.asp
    Am I using the right driver? I can connect sucessfully to this same database through a DNS on coldfusion!

  19. #19
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could this have anythign to do with having Cold Fusion installed on my system? I created a brand spakin' new DSN through control panel, and used Macromedia UltraDev to create a page and it STILL WON"T WORK!

  20. #20
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's probably the version of MDAC that you've got installed. Version 2.7 doesn't come with the Access oledb provider or odbc drivers. They have to be installed separately.

    http://support.microsoft.com/support.../Q271/9/08.ASP

    Try installing the drivers/provider as detailed in the kb article and see how you get on.

  21. #21
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I believe you're right

    However, I can connect to this database through cold fusion which is also installed on this machine, I was looking in OBDC and I have 2 drivers for Microsoft Access.... One is like do Microsoft Access and the other is just Microsoft Access, when I get home I'll write out their real names.


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
  •