Merging ASP code for dsn-less connection

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Merging ASP code for dsn-less connection

    Hi Everyone. I need a little help with an asp dsn-less connection. I
    currently have an application that uses a dsn less connection. It was hand
    coded by a programmer who no longer works for me, but the code works great.
    Now, I have expanded the application and used DW's server behaviors to write
    all my asp. Again, it worked great, though I did have to set up a dsn and use
    that for the conn to my database. I tried in vain to get DW to use a
    dsn-less connection for the new parts of my app, but was unsuccessful so I gave
    up and created a dsn. So I now have a fully working app that uses a dsn conn
    and a dsn-less conn. Everything is currently running on our internal dev
    server. When I move the app to the live server, I'd like to use all dsn-less
    connections. So here's my question...can anyone tell me how to modify DW's
    code (that uses dsn) to make a dsn-less connection that will work in DW?
    Here's the blocks of code I currently use: dsn-less: '// OPEN DATABASE
    CONNECTION PathToDB = '../sample.mdb' Dim conn Set conn =
    Server.CreateObject('ADODB.Connection') conn.Open('DRIVER={Microsoft Access
    Driver (*.mdb)}; DBQ=' & _ Server.MapPath(PathToDB))
    ------------------- dsn using DW: var ViewIssues =
    Server.CreateObject('ADODB.Recordset'); ViewIssues.ActiveConnection =
    MM_connViewPoint_STRING; ViewIssues.Source = 'SELECT * FROM issues ORDER BY
    EndDate ASC'; ViewIssues.CursorType = 0; ViewIssues.CursorLocation = 2;
    ViewIssues.LockType = 1; ViewIssues.Open(); var ViewIssues_numRows = 0;
    --------- So how can I merge the 2 blocks of code to create 1 dsn-less
    connection that will work in DW? Any help is appreciated. dlc

    dlcmpls Guest

  2. Similar Questions and Discussions

    1. Disconnect connection to database in code
      I need to include a statement in my code to "disconnect the connection to the database once you have fetched the data necessary". I researched the...
    2. mysql connection error code 404
      i am using a mac and trying to set up the ysql connection with no luck at all . i had it going ok on my windows machine but now nothing. i can write...
    3. more connection code problems
      Hi Stuart, The code below doesn't use an ADODB.Command object - it uses an ADODB.Recordset object Also, it implicitly creates an...
    4. connection code, I think.
      I'm used to doing ASP with SQL Server, but now I'm doing something with Access. Never understood connection strongs, but managed to get by with...
    5. Maybe Database connection pools should be managed by Admins instead of Developers using Code?
      This would be something that 2003 server and ASP.Net would use, ie, another section of the IIS whereas you could manage connection strings and such...
  3. #2

    Default Re: Merging ASP code for dsn-less connection

    DW will have created a connection file which it will have placed in a
    /connections folder. A DSN connection will look something like this

    <%
    Dim MM_conMag_STRING
    MM_conMag_STRING = "dsn=SNZSched;"
    %>

    To change this to DSN-less the second line becomes

    MM_conMag_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("/_database/schedule2002.mdb")
    if you are using the server mapping or the following if you specify absolute
    addresses.

    MM_conMag_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=d:\magazineadverts\schedule2002.mdb;"


    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "dlcmpls" <webforumsuser@macromedia.com> wrote in message
    news:d0l244$cuk$1@forums.macromedia.com...
    > Hi Everyone. I need a little help with an asp dsn-less connection. I
    > currently have an application that uses a dsn less connection. It was
    hand
    > coded by a programmer who no longer works for me, but the code works
    great.
    > Now, I have expanded the application and used DW's server behaviors to
    write
    > all my asp. Again, it worked great, though I did have to set up a dsn and
    use
    > that for the conn to my database. I tried in vain to get DW to use a
    > dsn-less connection for the new parts of my app, but was unsuccessful so I
    gave
    > up and created a dsn. So I now have a fully working app that uses a dsn
    conn
    > and a dsn-less conn. Everything is currently running on our internal
    dev
    > server. When I move the app to the live server, I'd like to use all
    dsn-less
    > connections. So here's my question...can anyone tell me how to modify
    DW's
    > code (that uses dsn) to make a dsn-less connection that will work in DW?
    > Here's the blocks of code I currently use: dsn-less: '// OPEN DATABASE
    > CONNECTION PathToDB = '../sample.mdb' Dim conn Set conn =
    > Server.CreateObject('ADODB.Connection') conn.Open('DRIVER={Microsoft
    Access
    > Driver (*.mdb)}; DBQ=' &amp; _ Server.MapPath(PathToDB))
    > ------------------- dsn using DW: var ViewIssues =
    > Server.CreateObject('ADODB.Recordset'); ViewIssues.ActiveConnection =
    > MM_connViewPoint_STRING; ViewIssues.Source = 'SELECT * FROM issues ORDER
    BY
    > EndDate ASC'; ViewIssues.CursorType = 0; ViewIssues.CursorLocation = 2;
    > ViewIssues.LockType = 1; ViewIssues.Open(); var ViewIssues_numRows = 0;
    > --------- So how can I merge the 2 blocks of code to create 1 dsn-less
    > connection that will work in DW? Any help is appreciated. dlc
    >

    Paul Whitham TMM Guest

Posting Permissions

  • You may not post new threads
  • You may 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