You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the ATL Project Wizard and ATL OLE DB Consumer Wizard to generate an OLE DB Templates consumer.
17
17
18
-
###To create a console application for an OLE DB consumer
18
+
## To create a console application for an OLE DB consumer
19
19
20
20
1. On the **File** menu, click **New**, and then click **Project**.
21
21
22
22
The **New Project** dialog box appears.
23
23
24
-
1. In the Project Types pane, click the **Visual C++ Projects** folder, and then click the **Win32 Project** icon in the Templates pane. In the **Name** box, enter the name of your project, for example, **MyCons**.
24
+
1. In the **Project Types** pane, click the **Installed** > **Templates** > **Visual C++** folder, and then click the **Win32 Console Application** icon in the **Templates** pane. In the **Name** box, enter the name of your project, for example, *MyCons*.
25
25
26
26
1. Click **OK**.
27
27
28
-
The Win32 Project Wizard appears.
28
+
The Win32 Application Wizard appears.
29
29
30
-
1. On the **Application Settings** page, select **Console application**, and then select **Add support for ATL**.
30
+
1. On the **Application Settings** page, select **Console application**, and then select **Add common header files for ATL**.
31
31
32
32
1. Click **Finish** to close the wizard and generate the project.
33
33
34
34
Next, use the ATL OLE DB Consumer Wizard to add an OLE DB consumer object.
35
35
36
-
####To create a consumer with the ATL OLE DB Consumer Wizard
36
+
## To create a consumer with the ATL OLE DB Consumer Wizard
37
37
38
-
1. In Class View, right-click the `MyCons` project.
38
+
1. In **Solution Explorer**, right-click the `MyCons` project.
39
39
40
-
1. On the shortcut menu, click **Add**, and then click **Add Class**.
40
+
1. On the shortcut menu, click **Add**, and then click **Class**.
41
41
42
42
The **Add Class** dialog box appears.
43
43
44
-
1. In the Categories pane, click **Visual C++**, click the **ATL OLE DB Consumer** icon in the Templates pane, and then click **Open**.
44
+
1. In the **Categories** pane, click **Installed** > **Visual C++** > **ATL**, click the **ATL OLEDB Consumer** icon in the **Templates** pane, and then click **Add**.
45
45
46
-
The ATL OLE DB Consumer Wizard appears.
46
+
The ATL OLEDB Consumer Wizard appears.
47
47
48
48
1. Click the **Data Source** button.
49
49
@@ -53,10 +53,10 @@ Next, use the ATL OLE DB Consumer Wizard to add an OLE DB consumer object.
53
53
54
54
- On the **Provider** tab, specify an OLE DB provider.
55
55
56
-
- On the **Connection** tab, specify the server name, logon ID, and password for your data source and database on the server.
56
+
- On the **Connection** tab, specify the required information, such as server name, logon ID, and password for your data source and database on the server.
57
57
58
58
> [!NOTE]
59
-
> There is a security issue with the **Allow saving of password** feature of the **Data Link Properties** dialog box. In **Enter information to log on to the server**, there are two radio buttons: **Use Windows NT integrated security** and **Use a specific user name and password**.
59
+
> There is a security issue with the **Allow saving password** feature of the **Data Link Properties** dialog box. In **Enter information to log on to the server**, there are two radio buttons: **Use Windows NT integrated security** and **Use a specific user name and password**.
60
60
61
61
> [!NOTE]
62
62
> If you select **Use a specific user name and password**, you have the option of saving the password (using the **Allow saving password** check box); however, this option is not secure. It is recommended that you select **Use Windows NT integrated security**; this option uses Windows NT to verify your identity.
@@ -68,7 +68,7 @@ Next, use the ATL OLE DB Consumer Wizard to add an OLE DB consumer object.
68
68
69
69
The **Select Database Object** dialog box appears.
70
70
71
-
1. Use the tree control to select a table, view, or stored procedure. For the purpose of this procedure, select the Products table from the Northwind database.
71
+
1. Use the tree control to select a table, view, or stored procedure. For the purpose of this procedure, select the `Products` table from the `Northwind` database.
72
72
73
73
1. Click **OK**. This returns you to the ATL OLE DB Consumer Wizard.
Copy file name to clipboardExpand all lines: docs/data/oledb/implementing-a-simple-consumer.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -22,17 +22,17 @@ The following topics show how to edit the files created by the MFC Application W
22
22
- "Adding XML Support to the Consumer" shows how to modify the consumer code to output the retrieved rowset data as XML data.
23
23
24
24
> [!NOTE]
25
-
> You can use the consumer application described in this section to test the MyProv and Provider sample providers.
25
+
> You can use the consumer application described in this section to test the MyProv and Provider sample providers.
26
26
27
27
> [!NOTE]
28
-
> To build a consumer application to test MyProv (the same provider described in [Enhancing the Simple Read-Only Provider](../../data/oledb/enhancing-the-simple-read-only-provider.md)), you must include bookmark support as described in "Adding Bookmark Support to the Consumer."
28
+
> To build a consumer application to test MyProv (the same provider described in [Enhancing the Simple Read-Only Provider](../../data/oledb/enhancing-the-simple-read-only-provider.md)), you must include bookmark support as described in "Adding Bookmark Support to the Consumer."
29
29
30
30
> [!NOTE]
31
-
> To build a consumer application to test Provider, leave out the bookmark support described in "Adding Bookmark Support to the Consumer" and skip to "Adding XML Support to the Consumer."
31
+
> To build a consumer application to test Provider, leave out the bookmark support described in "Adding Bookmark Support to the Consumer" and skip to "Adding XML Support to the Consumer."
32
32
33
33
## Retrieving Data with the Consumer
34
34
35
-
####To modify the console application to use the OLE DB consumer
35
+
### To modify the console application to use the OLE DB consumer
36
36
37
37
1. In MyCons.cpp, change the main code by inserting the bold text as follows:
38
38
@@ -82,9 +82,9 @@ The previous steps give you bookmark support and a bookmark object with which to
82
82
- Output the bookmarked row, appending it to the end of the file.
83
83
84
84
> [!NOTE]
85
-
> If you use this consumer application to test the Provider sample provider application, leave out the bookmark support described in this section.
85
+
> If you use this consumer application to test the Provider sample provider application, leave out the bookmark support described in this section.
86
86
87
-
####To instantiate the bookmark
87
+
### To instantiate the bookmark
88
88
89
89
1. The accessor needs to contain an object of type [CBookmark](../../data/oledb/cbookmark-class.md). The *nSize* parameter specifies the size of the bookmark buffer in bytes (typically 4 for 32-bit platforms and 8 for 64-bit platforms). Add the following declaration to the column data members in the user record class:
90
90
@@ -99,7 +99,7 @@ The previous steps give you bookmark support and a bookmark object with which to
99
99
...
100
100
```
101
101
102
-
####To request a bookmark column from the provider
102
+
### To request a bookmark column from the provider
103
103
104
104
1. Add the following code in the `GetRowsetProperties` method in the user record class:
105
105
@@ -113,7 +113,7 @@ The previous steps give you bookmark support and a bookmark object with which to
113
113
}
114
114
```
115
115
116
-
####To add a bookmark entry to the column map
116
+
### To add a bookmark entry to the column map
117
117
118
118
1. Add the following entry to the column map in the user record class:
119
119
@@ -127,7 +127,7 @@ The previous steps give you bookmark support and a bookmark object with which to
127
127
END_COLUMN_MAP()
128
128
```
129
129
130
-
####To use a bookmark in your main code
130
+
### To use a bookmark in your main code
131
131
132
132
1. In the MyCons.cpp file from the console application you previously created, change the main code to read as follows. To use bookmarks, the main code needs to instantiate its own bookmark object (`myBookmark`); this is a different bookmark from the one in the accessor (`m_bookmark`).
133
133
@@ -172,7 +172,7 @@ The previous steps give you bookmark support and a bookmark object with which to
@@ -204,15 +204,15 @@ For more information about bookmarks, see [Using Bookmarks](../../data/oledb/usi
204
204
205
205
As discussed in [Accessing XML Data](../../data/oledb/accessing-xml-data.md), there are two ways to retrieve XML data from a data source: using [CStreamRowset](../../data/oledb/cstreamrowset-class.md) or using [CXMLAccessor](../../data/oledb/cxmlaccessor-class.md). This example uses `CStreamRowset`, which is more efficient, but requires you to have SQL Server 2000 running on the computer on which you execute this sample application.
206
206
207
-
####To modify the command class to inherit from CStreamRowset
207
+
### To modify the command class to inherit from CStreamRowset
208
208
209
209
1. In the consumer application you previously created, change your `CCommand` declaration to specify `CStreamRowset` as the rowset class as follows:
0 commit comments