Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2005, 05:22 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default MySQL hit to batabase with ASP

I have set up this connection in my ASP, is that the safest and tightest way to use and close a MySQL hit?

Code:
set rs=con.execute("select * from net_company where companyid = '" & trim(session("agencyid")) & "' and agencyid <> '" & trim(session("agencyid")) & "'")
if (not rs.eof) AND (not rs.bof) then
do until rs.eof
%>
<tr bordercolor="#CCCCCC" bgcolor="#ECECEC">
    <td><%=ucase(trim(rs("company_name")))%></td>
    <td><%=ucase(trim(rs("towncity")))%></td>
    <td><%=trim(rs("phone"))%></td>
    <td><%=trim(rs("email"))%></td>
</tr>
<%
rs.movenext
loop
rs.close
Set rs = Nothing

www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old November 15th, 2005, 05:25 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

i am trying to keep it as tight as possible to allow it to run on all environments

www.crmpicco.co.uk
 
Old November 15th, 2005, 05:38 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Picco,

Not exactly sure what you're after, can you explain what you mean by "all environments"?

There is no need to check both .EOF and .BOF properties when you open a recordset, checking either one is sufficient.

I would state adCmdText when using Execute() if you know you are opening a query rather than a stored procedure or table. Tis way the machine does not have to check what you are passing it before running it against the db.
Code:
.Execute(query, , adCmdText)
HTH,

Chris
 
Old November 15th, 2005, 06:13 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

does that run on all environments, what i mean by that is - does it run on Win2003 server, WinXP IIS etc....

www.crmpicco.co.uk
 
Old November 15th, 2005, 06:17 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

so, does adCmdText speed up the processing of the DB hit?

www.crmpicco.co.uk
 
Old November 15th, 2005, 06:30 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

The different environments will be processing your ASP via IIS (or even PWS), so you should get the same results.

Have you be getting different results in different places?

You may get different results with different versions of MyODBC, I have noticed this in particular with empty longtext fields.

Using adCmdText should give a marginal gain in processing, no doubt very small, but every little helps.

 
Old November 15th, 2005, 07:20 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks Chris, are there any other pieces of code like that you would recommend?

I have been getting different results with recordsets on Win2003 Server and WinXP

www.crmpicco.co.uk
 
Old November 15th, 2005, 07:46 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

I do nearly all development on server machines, so don't have in depth XP experience as a development platform.

Differences in MySQL, MyODBC and MDAC versions between machines could all be to blame.

I have had problems with the ADO/MyODBC driver combination and now nearly always use client side cursors when using MySQL, as this seems to reduce the number of issues drastically. It may be worth a try in your situation.

What are the differences you are finding?
 
Old November 15th, 2005, 12:02 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

the differences i seemed to be experiancing are that on Windows 2003 server I needed to keep everything much tighter, by adding in bof/eof checks.
however, locally on XP Pro these bof/eof checks are not needed???

along the same lines of the adCmdText are there any other checks or pieces of code that I should think of adding in?
Code:
set rsspecialinfo = con.execute("SELECT exp_mouse_over FROM `net_leg2` WHERE contract_id = '"& contractId &"' AND fare_id = '" & fareId & "'", adCmdText)
www.crmpicco.co.uk
 
Old November 15th, 2005, 12:03 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

my main aim is to make the code cross-platform as well as making it fast as possible to process

www.crmpicco.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create ASP.NET Hit Counter and Guest Book nabeeljohn ASP.NET 2.0 Basics 1 June 12th, 2007 04:12 AM
how to add a hit counter in asp.net page narayannayakmca ASP.NET 1.0 and 1.1 Basics 1 January 3rd, 2007 01:11 PM
javascript remove bad characters for MySQL db hit crmpicco Javascript How-To 25 March 29th, 2006 06:34 AM
dynamic MySQL hit crmpicco Classic ASP Databases 1 June 17th, 2005 07:39 AM
MySQL with ASP ??? Varg_88 Classic ASP Databases 0 December 11th, 2004 05:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.