ASP Error when trying to run simple record count script

Talon

2[H]4U
Joined
Apr 8, 2002
Messages
3,684
I'm trying to write a simple ASP script that will connect to a MySQL database, count the number of records, and then display that count on a page.

Code:
<%@Language="VBScript"%>

<%
dim Conn, myRS

Set Conn = Server.CreateObject("ADODB.Connection") 

DSN = "DRIVER={MySQL ODBC 3.51 Driver};Server=server_name;Database=db_name;UID=user_name;PWD=password;OPTION=35;"
		
Conn.Open DSN
						
Set myRS = Conn.Execute("SELECT COUNT(objects.ObjectID) FROM objects")
%>
		
<html>
	<body>
				
	<% Response.write(myRS) %>
		
	</body>
</html>

When I access the page containing the following script I recieve the error:

Response object error 'ASP 0185 : 8002000e'

Missing Default Property

/objcount.asp, line 0

A default property was not found for the object.

Any ideas on what is wrong and how I can rework this to display properly?
 
try this
Code:
set myRS = Server.CreateObject("ADODB.Recordset")
myRS.Open = "SELECT COUNT(objects.ObjectID) AS num FROM objects",conn
.
.
<body>
<% Response.Write myRS("num") %>
 
Back
Top