SunQuest
 
       ASP Code
  Home arrow ASP Code arrow DSN-Less Connection Code Generator by Davi...
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

DSN-Less Connection Code Generator by David Lohmann
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 1
    2000-08-13

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!

    It's a simple form which writes out my DSN-less connection code for me. Just type in the variable names and hit submit, then copy and paste. Used mainly for adding or updating records without using the ADODB.Connection object.

    Thanks
    David Lohmann

     

    <%@language=vbscript%>
    <!--****Use this code freely. Just remember me when you're recruiting!!!****
    //****Dave Lohmann dloh@uk2.net****-->

    <%

    dim sent, dbcon, folder, file, rsname, table, csr1, csr2

    sent=request.form("sent")
    if sent="true" then
    dbcon=request.form("T1")
    folder=request.form("T2")
    file=request.form("T3")
    table=request.form("T4")
    rsname=request.form("T5")
    csr1=request.form("T6")
    csr2=request.form("T7")

    response.write "<b>Copy and paste this code into your ASP page.</b><p>"
    response.write dbcon&" = ""DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=""&Server.mapPath("&""""
    response.write folder&"\"&file&".mdb"")<p>"

    response.write "Set "&rsname&"=Server.CreateObject("&"""ADODB.Recordset"&""")<p>"
    response.write rsname&".Open "&""""&table&""", "&dbcon&", "&csr1&", "&csr2&"<p>"
    response.write "<b>(Don't forget to close the Recordset object.)</b><p>"
    response.write rsname&".close<p>Set "&rsname&"=Nothing"
    Else

    %>

    <html>

    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1">

    <title>DSN-Less Connection Code Generator</title>
    </head>

    <body bgcolor="#FFFFFF">

    <h1 align="center">DSN-Less Connection Code Generator</h1>
    <h4 align="center">(For Microsoft Access)</h4>
    <hr>
    <form action="setconn.asp" method="POST">
    <div align="center"><table border="0"
    cellpadding="4" cellspacing="0" width="100%">
    <tr>
    <td align="right" width="50%">Database Connection Variable:</td>
    <td width="50%"><input type="text" size="20"
    name="T1" value="strConn"></td>
    </tr>
    <tr>
    <td align="right" width="50%">Database Folder:</td>
    <td width="50%"><input type="text" size="20"
    name="T2"></td>
    </tr>
    <tr>
    <td align="right" width="50%">Database Filename:</td>
    <td width="50%"><input type="text" size="20"
    name="T3">.mdb</td>
    </tr>
    <tr>
    <td align="right" width="50%">Database Table Name:</td>
    <td width="50%"><input type="text" size="20"
    name="T4"></td>
    </tr>
    <tr>
    <td align="right" width="50%">Recordset Variable Name:</td>
    <td width="50%"><input type="text" size="20"
    name="T5" value="ObjRs"></td>
    </tr>
    <tr>
    <td align="right" width="50%">Cursor Type 1:</td>
    <td width="50%"><input type="text" size="20"
    name="T6" value="2"></td>
    </tr>
    <tr>
    <td align="right" width="50%">Cursor Type 2:</td>
    <td width="50%"><input type="text" size="20"
    name="T7" value="2">
    <input type="hidden" name="sent" value="true"></td>
    </tr>
    </table>
    <p align="center"><input type="submit"
    name="B1" value="Submit">&nbsp;<input type="reset" name="B2"
    value="Reset"></p>
    </div>
    </form>
    </body>
    </html>
    <%End If%>


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Calling all CC Power Users – and those that would like to be!

    Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development
    FREE! Go There Now!


    NEW! Download DB2 9.5 for Linux, Unix, and Windows

    Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Developer for System i V7.1

    Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications.
    FREE! Go There Now!


    NEW! Innovate don't duplicate! Asset reuse strategies for success

    Asset Reuse is a key strategy for companies looking to create innovative solutions to solve complex software development problems. Searching for, identifying, updating, using and deploying software assets can be a difficult challenge. Listen to this webcast, to learn about strategies and tools that you can leverage for a successful project, including Rational Asset Manager, Rational Software Architect and WebSphere Service Registry and Repository.
    FREE! Go There Now!


    NEW! Maintaining QoS and Process Integrity in an SOA Environment

    This webcast outlines the best practices that must be instituted to gain the maximum benefit from SOA while maintaining high quality of service. Whether you are deploying new applications or managing and monitoring your existing infrastructure, learn how you can ensure high quality of services with SOA based solutions from IBM. All registrants who attend this live Web Seminar will receive complimentary access to a white paper titled “Maintaining QoS in an SOA Environment”.
    FREE! Go There Now!


    NEW! Rational Talks to You: Scott Ambler on being agile in a global development environment

    Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered!
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Process

    Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly.
    FREE! Go There Now!


    NEW! Webcast: Eclipse: Empowering the universal platform

    The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now.
    FREE! Go There Now!


    NEW! Webcast: Quickly provide customized, integrated user interfaces with Lotus Notes 8

    IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway