Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 30th, 2003, 10:05 AM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default command object and objconn.execute...

Hey,

I just want to know the difference between the two?
Both are used to update, but when do i use the command object?

 
Old October 3rd, 2003, 02:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Usually Command objects are used when dealing with paramtised queries, such as SQL Server stored procedures. You can just Exec a sproc using objConn.Execute, however I prefer to use a Command object as that gives you a modicum of value typing, and allow easy access to output parameters and return values.

Additionally, the code ends up a lot easier to read!

Lastly, using a command object and parameter objects means you don't have to worry about sanitising your input (eg replacing ' with '') to avoid SQL Injection attacks.

(assuming you are not building a dynamic SQL string in your sproc and executing it)

Cheers
Ken

Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Command text was not set for the command object Sheraz Khan Classic ASP Databases 2 May 29th, 2007 12:57 AM
connection.execute and command.execute difference vinod_yadav1919 Classic ASP Databases 0 September 28th, 2005 06:34 AM
conn.execute,command.execute or rs.open vinod_yadav1919 Crystal Reports 0 January 3rd, 2005 10:26 AM
Command text was not set for the command object. deepa12 BOOK: Beginning ASP 3.0 5 November 2nd, 2004 05:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.