Creates a named object that represents a SQL statement.
PSConnectionClass objects
connectionobject.CreateCommand( sql )
Argument |
Description |
---|---|
connectionobject |
A variable that contains a reference to an instance of PSConnectionClass |
sql |
A string that specifies the SQL statement |
PSCommandClass object
CreateCommand allows you to execute the same SQL statement multiple times on a single page. Once you have created the command object, you can execute the command by calling the Execute method.
At runtime, CreateCommand returns a command object that can be used to execute the SQL statement that you pass as an argument.
The following code creates a SQL command object named mycommand and executes the SQL statement associated with the command:
PSCommandClass mycommand;
mycommand = myconnect.CreateCommand("SELECT * FROM products");
mycommand.Execute();