ASP Code
  Home arrow ASP Code arrow DSN-Less Connection Code Generator by Davi...
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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


    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! Accelerating Software Innovation on i on Power Systems

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Develop Systems Software Assets with IBM Rational Asset Manager

    Join us for this on demand webcast to learn about developing complex systems more quickly and efficiently. We'll cover market drivers for developing, governing and reusing systems software assets and how you can develop system software assets with Rational Asset Manager.
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Webcast: Application security testing and Web compliance

    Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    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-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek