Skip to content

Commit 81d77c9

Browse files
author
Colin Robertson
authored
Merge pull request #1461 from msebolt/oledb-procedural-pr1
oledb procedural pr1
2 parents 74f036f + 53a6320 commit 81d77c9

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

docs/data/oledb/creating-a-simple-consumer.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Creating a Simple Consumer | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
@@ -15,35 +15,35 @@ ms.workload: ["cplusplus", "data-storage"]
1515

1616
Use the ATL Project Wizard and ATL OLE DB Consumer Wizard to generate an OLE DB Templates consumer.
1717

18-
### To create a console application for an OLE DB consumer
18+
## To create a console application for an OLE DB consumer
1919

2020
1. On the **File** menu, click **New**, and then click **Project**.
2121

2222
The **New Project** dialog box appears.
2323

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*.
2525

2626
1. Click **OK**.
2727

28-
The Win32 Project Wizard appears.
28+
The Win32 Application Wizard appears.
2929

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**.
3131

3232
1. Click **Finish** to close the wizard and generate the project.
3333

3434
Next, use the ATL OLE DB Consumer Wizard to add an OLE DB consumer object.
3535

36-
#### To create a consumer with the ATL OLE DB Consumer Wizard
36+
## To create a consumer with the ATL OLE DB Consumer Wizard
3737

38-
1. In Class View, right-click the `MyCons` project.
38+
1. In **Solution Explorer**, right-click the `MyCons` project.
3939

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**.
4141

4242
The **Add Class** dialog box appears.
4343

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**.
4545

46-
The ATL OLE DB Consumer Wizard appears.
46+
The ATL OLEDB Consumer Wizard appears.
4747

4848
1. Click the **Data Source** button.
4949

@@ -53,10 +53,10 @@ Next, use the ATL OLE DB Consumer Wizard to add an OLE DB consumer object.
5353

5454
- On the **Provider** tab, specify an OLE DB provider.
5555

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.
5757

5858
> [!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**.
6060
6161
> [!NOTE]
6262
> 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.
6868

6969
The **Select Database Object** dialog box appears.
7070

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.
7272

7373
1. Click **OK**. This returns you to the ATL OLE DB Consumer Wizard.
7474

docs/data/oledb/implementing-a-simple-consumer.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ The following topics show how to edit the files created by the MFC Application W
2222
- "Adding XML Support to the Consumer" shows how to modify the consumer code to output the retrieved rowset data as XML data.
2323

2424
> [!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.
2626
2727
> [!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."
2929
3030
> [!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."
3232
3333
## Retrieving Data with the Consumer
3434

35-
#### To modify the console application to use the OLE DB consumer
35+
### To modify the console application to use the OLE DB consumer
3636

3737
1. In MyCons.cpp, change the main code by inserting the bold text as follows:
3838

@@ -82,9 +82,9 @@ The previous steps give you bookmark support and a bookmark object with which to
8282
- Output the bookmarked row, appending it to the end of the file.
8383

8484
> [!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.
8686
87-
#### To instantiate the bookmark
87+
### To instantiate the bookmark
8888

8989
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:
9090

@@ -99,7 +99,7 @@ The previous steps give you bookmark support and a bookmark object with which to
9999
...
100100
```
101101

102-
#### To request a bookmark column from the provider
102+
### To request a bookmark column from the provider
103103

104104
1. Add the following code in the `GetRowsetProperties` method in the user record class:
105105

@@ -113,7 +113,7 @@ The previous steps give you bookmark support and a bookmark object with which to
113113
}
114114
```
115115

116-
#### To add a bookmark entry to the column map
116+
### To add a bookmark entry to the column map
117117

118118
1. Add the following entry to the column map in the user record class:
119119

@@ -127,7 +127,7 @@ The previous steps give you bookmark support and a bookmark object with which to
127127
END_COLUMN_MAP()
128128
```
129129

130-
#### To use a bookmark in your main code
130+
### To use a bookmark in your main code
131131

132132
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`).
133133

@@ -172,7 +172,7 @@ The previous steps give you bookmark support and a bookmark object with which to
172172
{
173173
nCounter++;
174174
if(nCounter == 5 )
175-
myBookmark = rs.bookmark;
175+
myBookmark = rs.m_bookmark;
176176
// Output the column information for each row:
177177
outfile << rs.m_ProductID << rs.m_ProductName << lPrice << rs.m_QuantityPerUnit << rs.m_UnitsInStock << rs.m_ReorderLevel << endl;
178178
hr = rs.MoveNext();
@@ -204,15 +204,15 @@ For more information about bookmarks, see [Using Bookmarks](../../data/oledb/usi
204204

205205
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.
206206

207-
#### To modify the command class to inherit from CStreamRowset
207+
### To modify the command class to inherit from CStreamRowset
208208

209209
1. In the consumer application you previously created, change your `CCommand` declaration to specify `CStreamRowset` as the rowset class as follows:
210210

211211
```cpp
212212
class CProducts : public CCommand<CAccessor<CProductsAccessor>, CStreamRowset >
213213
```
214214

215-
#### To modify the main code to retrieve and output the XML data
215+
### To modify the main code to retrieve and output the XML data
216216

217217
1. In the MyCons.cpp file from the console application you previously created, change the main code to read as follows:
218218

0 commit comments

Comments
 (0)