Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - faster way to conect to a database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

faster way to conect to a database

 Post Reply Post Reply
Author
vdub View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 February 2003
Location: United States
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote vdub Quote  Post ReplyReply Direct Link To This Post Topic: faster way to conect to a database
    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.

Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2003 at 3:21pm
Only for DSN users, not using DSN is faster
Back to Top
vdub View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 February 2003
Location: United States
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote vdub Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2003 at 3:53pm
Would I be able to change the database conection with out changing much of the code.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.