SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is my coding crap...

    ive seen from every else's coding, that they make a connection object in asp to a db, then make an Recordset to it... but i never do...

    i jus do the below
    Code:
    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("./data.mdb")
    SET objDBCon = Server.CreateObject("ADODB.Connection")
    objDBCon.open strConnect
    
    Set getApp = objDBCon.Execute("SELECT * FROM tblsSetup")
    this is because i read somewhere once that this is a more efficient way of doing things... is it? or have i jus been coding bad?

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,294
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    I don't think it's bad coding. I think you might be right about the efficiency, but I think the other way is easier to read in the long run. It's more personal preference than anything else....
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  3. #3
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dave summed it up there. Couldn't have said it better.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  4. #4
    Xbox why have you forsaken me? moospot's Avatar
    Join Date
    Feb 2001
    Location
    Clearwater, FL
    Posts
    3,615
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My site was designed from MS Site Server Commerce and places the connection object in the global.asa. Therefore, I do not need to re-create the connection object every time I want to connect to the database.

    I think it's a matter of personal opinion, but if I can save a couple of lines of coding on each page that connects to the db, then I will. Of course, I do most of the work on the site by myself, so I know what is going on on each page.

  5. #5
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    generally when i start developing a site, i use an include file that has a huge class object in it with tonnes of functions, from validating email, to counting words etc. etc. (maybe i should put it on my site) and when the development os done, i simply take out all teh functions i used and stick them in another include file and upload it with that

  6. #6
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,123
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    connect.asp > db connection
    top.asp > any validation, password protecting, etc
    bottom.asp > closing anything done in top.asp
    functions.asp > all the stuff I use throughout the site to make my life easier

    I include all of the above... Which, yes, may slow down the execute time (we're talking 0.01 seconds here), but it's so much easier to maintain.
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •