Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 8

Initializing Command Objects in Code (VB6)

To programmatically initialize a Command object, you should take the following steps:

  1. Make sure that you have a valid Connection, as discussed earlier in the section "Programming the Connection Object."

  2. Declare an object variable of the type ADODB.Command.

  3. Set the CommandType property.

  4. Set the CommandText property.

  5. Call the Execute method.

  6. Set the ActiveConnection property to point to a valid existing Connection object.

NOTE - Further References: For examples and more information about the Execute method, see "Using Stored Procedures to Return Records to an Application" in Chapter 9 and the sections under "ADO Data Access Models" in the next chapter, "Creating Data Services: Part II." Also see "Using the Parameters Collection to Access Parameters for Stored Procedures" in the next chapter for information about how to pass parameters to a stored procedure.

Command Object Events

Surprise! ADO Command objects don't have any events. If you try to declare a Command object variable using the WithEvents keyword, you will receive a compiler error. Only Connection and Recordset objects support events in the ADO object model.

See Also


  

<< Previous | Contents | Next >>

Home | Link to Us | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved