I'm trying to access a mySQL database with ASP and am running into some errors. I got most everything working fine except for a couple things. When I try to use a COUNT(*) in my SQL statement, it causes problems.
The error message I'm getting is:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver does not support this parameter
The live number it gives me referrs to the objRS.MoveFirst command. Strangly, if I remove the "COUNT(*) as message_count" from the SQL statement, everything works fine. Any ideas why this might be happening? My source code is below.
FYI - I'm using the latest version of the myODBC drivers for mySQL
Source code:
<!-- #INCLUDE FILE="include/mini-adovbs.inc" -->
<%
Dim objConn, objRS, strSQL
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.open "DSN=Intranet2"
Set objRS = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT forum_id, COUNT(*) AS message_count FROM messages WHERE public= 'No' GROUP BY forum_id"
objRS.CursorLocation = adUseClient
objRS.Open strSQL, objConn, adOpenStatic, adLockOptimistic
objRS.MoveFirst
Do While NOT objRS.EOF
' Write the data out to test.
Response.Write objRS("forum_id"
& " " & objRS("message_count"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objConn = Nothing
Set objRS = Nothing
%>
The error message I'm getting is:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver does not support this parameter
The live number it gives me referrs to the objRS.MoveFirst command. Strangly, if I remove the "COUNT(*) as message_count" from the SQL statement, everything works fine. Any ideas why this might be happening? My source code is below.
FYI - I'm using the latest version of the myODBC drivers for mySQL
Source code:
<!-- #INCLUDE FILE="include/mini-adovbs.inc" -->
<%
Dim objConn, objRS, strSQL
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.open "DSN=Intranet2"
Set objRS = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT forum_id, COUNT(*) AS message_count FROM messages WHERE public= 'No' GROUP BY forum_id"
objRS.CursorLocation = adUseClient
objRS.Open strSQL, objConn, adOpenStatic, adLockOptimistic
objRS.MoveFirst
Do While NOT objRS.EOF
' Write the data out to test.
Response.Write objRS("forum_id"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objConn = Nothing
Set objRS = Nothing
%>