beginners tutorial - Learn VB6
VB6 tutorial - Learn Advanced VB6
VB .NET - Learn Visual Basic .NET
Analysis - System analysis and Design tutorial for Software Engineering
You are here: Visual
Basic > Advanced VB6 tutorial
> Chapter 8
Adding Connection and Command Objects With the Data Environment Designer
You can add Connection and Command objects to a Data Environment Designer. You
can then manipulate these objects from VB's Visual Design Environment, or in VB
STEP BY STEP
8.2 Adding Connection and Command Objects
Make sure that your VB
project contains a Data Environment Designer, as discussed in the preceding section.
Right-click on the Data Environment Designer's surface, and choose Add Connection,
as shown in Figure 8.3.
FIGURE 8.3. Adding a Connection object to a Data Environment Designer.
Right-click on the Connection object, and then choose Properties from the drop-down
On the Provider tab (see Figure 8.4), choose an OLE
DB Data Provider. (Some choices are Microsoft Jet 3.51 OLE DB (for MS Access
Microsoft OLE DB Provider for ODBC
Drivers, or Microsoft OLE DB Provider for SQL
FIGURE 8.4 Choosing the provider for a Connection object in the Data Environment
On the Connection tab (see Figure 8.5), set up the specific data connection
with the following steps. (Note that the contents of the tab will differ depending
on the type of data provider selected on the Connection tab.)
Set up the source of the data, whose nature will vary depending on the type
of connection. For a Jet data source (Microsoft
Access), you will specify the MDB file's name and path. For an ODBC
data source, you can specify a data source name (based on an existing DSN) or
a connection string that creates a new DSN.
FIGURE 8.5 Setting up connection information for a Connection object in the
Data Environment Designer.
Fill in logon information about the username and password.
Click OK to accept the ODBC
Data Source options you have built.
After you have data connections established, you can add Command objects to
the data connections.
STEP BY STEP
8.3 Adding Command Objects to the Data Connections
Right-click a Connection object and choose Add Command from the drop-down menu, as
in Figure 8.6.
FIGURE 8.6 Adding a Command object to a connection in the Data Environment Designer
On the General tab, give a name to the new Command object, as in Figure 8.7.
FIGURE 8.7 Setting general information about a Command object in the Data Environment
Change the connection information if you want to, or leave it the same to accept
the default Connection information from the Connection object.
Choose the Source of Data Database
Object = Table, Stored Procedure, View, or Synonym) (see Figure 8.8).
FIGURE 8.8. Setting information about the data source for a Command object in
a Data Environment Designer.
On the Advanced tab (Figure 8.9), you can set cursor type, cursor location, locking
strategy, and cache size. See later sections in this chapter on each of these subjects.
FIGURE 8.9. Advanced settings for a Command object in a Data Environment Designer.
Rename the object if you want.
Click OK. Your Command object is finished.
NOTE - Cursor Options on the Advanced Tab: You
can fine tune the Recordset's behavior by setting the CursorLocation, CursorType,
and Locktype properties with the correspondingly labeled fields on the Advanced
tab. These properties and their meaning are discussed at length in the next chapter.
<< Previous | Contents
| Next >>