Using Command Object with Parameters syntax example

Contributed by
Rating: 4 stars4 stars4 stars4 stars4 stars / 6
March 30, 2002
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

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>

blog comments powered by Disqus
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...
- Two combos, one textbox example
- ADO Recordset Paging
- SQL Server Database Creator - .NET Version
- Getting A List of Tables From SQL Server
- Discussion & Listserv Module by Mike Eck...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials