Professional Web Applications Themes

database connections in ASP - ASP Database

Hi guys... I am developing an application and need some advice while the application is still in its infancy. 1. Set Conn = Server.CreateObject("ADODB.Connection") 2. Conn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("doents.mdb") 3. Set rs = Server.CreateObject("ADODB.Recordset") 4. SQL="SELECT * FROM users" 6. rs.close 7. set rs=nothing My question is... is this the most efficient way to connect to the DB and shouldnt I be closing my Conn... cause when I try the system says that the obj doesnt exist... Any advice would be appreciated ! Evan...

  1. #1

    Default database connections in ASP

    Hi guys... I am developing an application and need some advice while
    the application is still in its infancy.

    1. Set Conn = Server.CreateObject("ADODB.Connection")
    2. Conn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
    Server.MapPath("doents.mdb")
    3. Set rs = Server.CreateObject("ADODB.Recordset")
    4. SQL="SELECT * FROM users"
    6. rs.close
    7. set rs=nothing

    My question is... is this the most efficient way to connect to the DB
    and shouldnt I be closing my Conn... cause when I try the system says
    that the obj doesnt exist...

    Any advice would be appreciated !

    Evan
    Evan Guest

  2. #2

    Default Re: database connections in ASP

    Try
     
    conn.open ConnText
    strSQL="SELECT * FROM users" 
    conn.close
    set conn= nothing

    You were setting the conn object then setting it to a string


    "Evan" <com> wrote in message
    news:google.com... 


    Steven Guest

  3. #3

    Default Re: database connections in ASP

    On 18 Oct 2004 06:25:25 -0700, com (Evan)
    wrote:
     

    That's an incorrect usage. You created the object, then set it as a
    string. What you want is to open the object, as in:

    Conn.Open = "PROVIDER=Microsoft.Jet.....

    Obviously, since you never opened it, closing it would cause an
    error... :)

    Jeff
     

    Jeff Guest

Similar Threads

  1. increase database connections
    By TangoRules in forum Coldfusion Database Access
    Replies: 3
    Last Post: June 9th, 01:13 PM
  2. Maintaining database connections
    By PegasusT4 in forum Coldfusion Database Access
    Replies: 0
    Last Post: April 26th, 02:55 PM
  3. CD/DVD and Database connections
    By iwearwatches in forum Macromedia Director Basics
    Replies: 1
    Last Post: March 1st, 10:37 PM
  4. #20006 [Com]: cannot use 2 database connections
    By ash at deakin dot edu dot au in forum PHP Development
    Replies: 0
    Last Post: November 12th, 06:43 AM
  5. Persistent database connections in PHP
    By David Brannlund in forum PHP Development
    Replies: 0
    Last Post: September 5th, 06:05 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139