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"> <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 developerWorks - FREE Tools! | 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!
| | | | 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!
| | | | 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!
| | | | 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!
| | | | 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!
| | | | 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!
| | | | 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!
| | | | 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!
| | | | 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!
| | | | 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! | |