Print Page | Close Window

faster way to conect to a database

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1510
Printed Date: 29 March 2026 at 10:26am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: faster way to conect to a database
Posted By: vdub
Subject: faster way to conect to a database
Date Posted: 31 March 2003 at 12:53pm

whatup everyone I have some code that I think could be made faster. I have been using this to display news on my front page for along time now but I think its to slow. check it out

'Create  DSN Less connection to Access Database
'Create DBConnection Object
Set DBConnection = Server.CreateObject("adodb.connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.Mappath("/databasename.mdb")
DBConnection.Open DSN

'Count the Records


   SQLcount = "Select * From tblTopic Where Forum_ID = 25 and Priority >0"
      Set RS = DBConnection.Execute(SQLcount)

 

 Select Case RS.eof
      Case False
        tempRSCount = RS.getrows
        Set RS = Nothing
        count = Cdbl(UBound(tempRSCount, 2)) + 1
               
     Case True
      count = "0"
 End Select
     Set RS = Nothing
     
       IF count > 0 Then
       IF count > numpin Then
       count = numpin
       End IF

'Start listing news

      while not count = 0
      count = count - 1
     
  SQL = "Select * From tblTopic Where Forum_ID =25 and Priority >0 ORDER BY Priority DESC"
      Set RS = DBConnection.Execute(SQL)
            
        rs.move idc
        idc = idc + 1
          
         
         title = rs("Subject")
         date1 = rs("Start_Date")
         topicnum = rs("Topic_ID")
         
'get reply_count
     
  SQL = "Select * From tblThread Where Topic_ID = "& topicnum
      Set RS = DBConnection.Execute(SQL)

  Select Case RS.eof
       Case False
         tempRSCount = RS.getrows
         Set RS = Nothing
         replys = Cdbl(UBound(tempRSCount, 2)) + 1
               
      Case True
      replys = "0"
  End Select
      Set RS = Nothing
   
    replys = replys - 1

'Get back to news
  
  SQL2 = "Select * From tblThread Where Topic_ID = "& topicnum
      Set RS = DBConnection.Execute(SQL2)
      
         Author = rs("Author_ID")
         content = rs("Message")
        
        SQL3 = "Select * From tblAuthor Where Author_ID = "& Author
      Set RS = DBConnection.Execute(SQL3)
      
      user = rs("Username")

         %> 
This is where I put the HTML to display the page

<%

<%
         
         rs.Movenext
                  
        wend
       Else
       End IF
%>

Dose anyone have any tips on this. I was thinking about using the forums database conection but I could use some tips on how I can get my code to do this.



-------------
http://www.CyberCPU.net - Hardware reviews, Forum, Free advertising!!!!



Replies:
Posted By: Gullanian
Date Posted: 31 March 2003 at 3:21pm
Only for DSN users, not using DSN is faster


Posted By: vdub
Date Posted: 31 March 2003 at 3:53pm
Would I be able to change the database conection with out changing much of the code.

-------------
http://www.CyberCPU.net - Hardware reviews, Forum, Free advertising!!!!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net