This is using the new WITH statement that comes with the latest scripting engine. One of the benefits of using this is you don't have to constantly refer to your object. If you have windows 2000/IIS 5.0, then you have the latest scripting engine.Create an connection to the db.
set conn = server.createobject("adodb.connection")
conn.open "dsn=sqlsvr;database=pubs;uid=sa;pwd=;"
'Set local variables equals to the form datastrCompanyName = request.form("CompanyName")
strCompanyAddress1 = request.form("CompanyAddress1")
strCompanyAddress2 = request.form("CompanyAddress2")
strCompanyCity = request.form("CompanyCity")
strCompanyState =request.form("CompanyState")
strCompanyZip = request.form("CompanyZip")
strCompanyCountry =request.form("CompanyCountry")
strPrice = request.form("Price")
strCompanyID = request.form("CompanyID")
Create Command Object
set cmd1 = server.createobject("adodb.command")
'Start Your WITH statement
'Notice after that you can just put a period then the method your callingWith cmd1
.activeconnection = strconn
.commandtext = "sp_update"
.CommandType = acCmdStoredProc
.parameters.append .createparameter("@CompanyName", adVarChar, adParamInput, 150, strCompanyName)
.parameters.append .createparameter("@CompanyAddress1", adVarChar, adParamInput, 255 , strCompanyAddress1)
.parameters.append .createparameter("@CompanyAddress2", adVarChar, adParamInput, 255 , strCompanyAddress2)
.parameters.append .createparameter("@CompanyCity", adVarChar, adParamInput, 150 , strCompanyCity)
.parameters.append .createparameter("@CompanyState", adVarChar, adParamInput, 50 , strCompanyState)
.parameters.append .createparameter("@CompanyZip", adVarChar, adParamInput, 50 , strCompanyZip)
.parameters.append .createparameter("@CompanyCountry", adVarChar, adParamInput, 100 , strCompanyCountry)
.parameters.append .createparameter("@Price", adVarChar, adParamInput, 50 , strPrice)
.parameters.append .createparameter("@companyID", adInteger, adParamInput, 0 , strCompanyID)
.execute lngRecs, , adExecuteNoRecords
'Once done put End WITH
End With
set cmd1 = nothing
| 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! |
Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle. FREE! Go There Now!
|
|
|
|
The discipline of assembling and delivering software is maturing beyond standard developer-centric compile/test software builds. The end-to-end software development lifecycle is emerging as the new focus moves “Beyond the Build.” Join this on demand webcast to learn about methods for streamlining software delivery and key capabilities of the IBM Rational Build Forge framework for automating build and release management in environments of any size. 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!
|
|
|
|
This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial version of WebSphere Business Modeler Advanced V6.1.1, IBM’s premier business process modeling and analysis tool for business users that offers process modeling, simulation, and analysis capabilities. IBM WebSphere Business Modeler helps you visualize, understand, and document business processes for continuous improvement. FREE! Go There Now!
|
|
|
|
Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996. FREE! Go There Now!
|
|
|
|
Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server. FREE! Go There Now!
|
|
|
|
As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |