Database Code
  Home arrow Database Code arrow Using Command Object with Parameters synta...
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? 
DATABASE CODE

Using Command Object with Parameters syntax example
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2002-03-30

    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


    Command Object Example

    <% @language="vbscript" ENABLESESSIONSTATE = FALSE %>
    <!--#include file="adovbs.inc"-->
    <%
    On Error Resume Next
    response.buffer=True
    dim conn

    set conn = server.createobject("adodb.connection")
    conn.open "DSN"

    response.write request.form("CompanyName") & "<br>"
    strCompanyName = 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")
    strCompanyURL = request.form("CompanyURL")
    strContactName = request.form("ContactName")
    strContactPhone = request.form("ContactPhone")
    strContactEmail = request.form("ContactEmail")
    strComponentName = request.form("ComponentName")
    strComponentDownloadlink = request.form("ComponentDownloadLink")
    strComponentDemoLink = request.form("ComponentDemoLink")
    strComponentDesc = request.form("ComponentDesc")
    strPrice = request.form("Price")
    strCompanyID = request.form("CompanyID")

    set cmd1 = server.createobject("adodb.command")
    with cmd1
        .activeconnection = strconn
        .commandtext = "sp_updateComponentInfo"
        .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("@CompanyURL", adVarChar, adParamInput, 255 , strCompanyURL)
        .parameters.append .createparameter("@ContactName", adVarChar, adParamInput, 100 , strContactName)
        .parameters.append .createparameter("@ContactPhone", adVarChar, adParamInput, 100 , strContactPhone)
        .parameters.append .createparameter("@ContactEmail", adVarChar, adParamInput, 150, strContactEmail)
        .parameters.append .createparameter("@ComponentName", adVarChar, adParamInput, 100 , strComponentName)
        .parameters.append .createparameter("@ComponentDownloadlink", adVarChar, adParamInput, 255 , strComponentDownloadLink)
        .parameters.append .createparameter("@ComponentDemoLink", adVarChar, adParamInput, 255 , strComponentDemoLink)
        .parameters.append .createparameter("@ComponentDesc", adVarChar, adParamInput, 255 , strComponentDesc)
        .parameters.append .createparameter("@Price", adVarChar, adParamInput, 50 , strPrice)
        .parameters.append .createparameter("@companyID", adInteger, adParamInput, 0 , strCompanyID)
        .parameters.append .createparameter("@CompanyName", adVarient, adParamInput, 150, strCompanyName)
        .execute lngRecs, , adExecuteNoRecords
    End With
    set cmd1 = nothing
    If err.number <> 0 Then
    response.write err.number
    response.write err.description
    response.end
    End If
    %>

    <html>
    <head><title></title></head>
    Your information is updated!
    </body>
    </html>


    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 Database Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Applying lean thinking to the governance of software development

    Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations.
    FREE! Go There Now!


    NEW! Did you say mainframe? e-kit

    Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise.
    FREE! Go There Now!


    NEW! Download a free trial of WebSphere Business Modeler Advanced V6.1.1

    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!


    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! IBM Rational AppScan Standard Edition V7.7

    Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7.
    FREE! Go There Now!


    NEW! Project and Portfolio Management Executive Resource Kit

    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!


    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! Trial download: IBM Informix Dynamic Server Express Edition V11.0

    Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data.
    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: IBM Rational Build Forge - Beyond the Build

    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!



    All FREE IBM® developerWorks Tools!

    DATABASE CODE ARTICLES

    - Deployment of the MobiLink Synchronization M...
    - MobiLink Synchronization Wizard in SQL Anywh...
    - Finding Matching Records in Data Access Pages
    - Using the AccessDataSource Control in VS 2005
    - A Closer Look at ADO.NET: The Command Object
    - A Closer Look at ADO.NET: The Connection Obj...
    - Using ADO to Communicate with the Database, ...
    - Code Snippets: Counting Records
    - Constraints In Microsoft SQL Server 2000
    - Multilingual entries into a DB and to be dis...
    - Getting A List of Tables From SQL Server
    - SQL Server Database Creator - .NET Version
    - ADO Recordset Paging
    - Two combos, one textbox example
    - Discussion & Listserv Module by Mike Eck...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek