Friday, January 16, 2009

The Command Text

The Command Text:

two main alternatives to specify this string.

Instead of declaring an OleDbCommand variable using the default constructor, you can use the second constructor whose syntax is:

Public Sub New(ByVal cmdText As String)


This constructor takes as argument a string that is
the object of the command. If you had declared the OleDbCommand
variable using the default constructor, to specify the command, you can
assign a string to the OleDbCommand.CommandText property. We will
see various examples of creating such a command text and using it.


The Connection to the Command
After creating a command, you must pass it to the database but the command has no way of find that database.
Remember that the connection knows where the database is, through its data source factor.

Public Sub New(ByVal cmdText As String, ByVal connection As OleDbConnection)
If you had declared an OleDbCommand variable
using its default constructor, to specify the connection, you can assign
it to the OleDbCommand.Connection property. In both cases, you
must provide an appropriate OleDbConnection value using the
techniques we reviewed earlier

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home