Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Why this code doesn't work with MySQL?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Skatan
Starting Member

15 Posts

Posted - 07 March 2001 :  16:52:55  Show Profile
Why this code won't work with MySQL?
It works fine with access.

<%
'Location of news database exact location on machine not web or you can use
a system DSN name
dbop= MM_ConnSMNews_STRING
function getComCount(art)

'this gets the number of comments for an article
ConnString = dbop
set MyConn= Server.CreateObject("ADODB.Connection")
MyConn.Open ConnString
strsql = "SELECT ID, Article FROM Comments where Article=" & art
Set rsx = Server.CreateObject("ADODB.RecordSet")
RSx.CursorType = 2
RSx.open strsql, MyConn, 3, 3
wha=rsx.recordcount
getComCount=wha
rsx.close
set rsx = nothing
MyConn.close
set MyConn = nothing
end function
%>

Please help a poor notupsizedyet guy!

Mat


davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 07 March 2001 :  18:03:38  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
Isn't ID field name for the counter variable in ACCESS? You might need to make sure you are specifying the field names correctly.

Do you have a specific error message you're getting??

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 07 March 2001 :  18:39:48  Show Profile
Probably differences in the recordcount property of the recordset. Recordcount fails under some circumstances, you may want to check your MySql ODBC documentation and see how recordcount is implemented.

Also, you set your cursor type to Dynamic, but then in your open statement you change it to a static cursor. One of those choices should probably be removed, although as your code stands the recordset should open with a static cursor.

You can use Select Count(*) as RecordCount from table as an alternate method of getting the recordcount.


======
Doug G
======
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 08 March 2001 :  01:05:28  Show Profile  Visit gor's Homepage
As far as I know MyODBC doesn't support recordcount

Pierre
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07