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
Copy file name to clipboardExpand all lines: docs/data/oledb/consumer-wizard-generated-classes.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,9 @@ When you use the ATL OLE DB Consumer Wizard to generate a consumer, you have the
30
30
> If you modify the user record class or write your own consumer, the data variables must come before the status and length variables.
31
31
32
32
> [!NOTE]
33
-
> The ATL OLE DB Consumer Wizard uses the **DB_NUMERIC** type to bind numeric data types. It formerly used **DBTYPE_VARNUMERIC** (the format of which is described by the **DB_VARNUMERIC** type; see Oledb.h). If you do not use the wizard to create consumers, it is recommended that you use **DB_NUMERIC**.
33
+
> The ATL OLE DB Consumer Wizard uses the `DB_NUMERIC` type to bind numeric data types. It formerly used `DBTYPE_VARNUMERIC` (the format of which is described by the `DB_VARNUMERIC` type; see Oledb.h). If you do not use the wizard to create consumers, it is recommended that you use `DB_NUMERIC`.
34
34
35
-
```
35
+
```cpp
36
36
// Products.H : Declaration of the CProducts class
37
37
38
38
classCProductsAccessor
@@ -78,7 +78,7 @@ public:
78
78
### Rowset Properties
79
79
Next, the wizard sets rowset properties. If you selected **Change**, **Insert**, or **Delete** in the ATL OLE DB Consumer Wizard, the appropriate properties are set here (DBPROP_IRowsetChange is always set, then one or more of DBPROPVAL_UP_CHANGE, DBPROPVAL_UP_INSERT, and/or DBPROPVAL_UP_DELETE, respectively).
If you specify a command class, the wizard declares the command class; for templated code, the command looks like this:
93
93
94
-
```
94
+
```cpp
95
95
DEFINE_COMMAND_EX(CProductsAccessor, L" \
96
96
SELECT \
97
97
ProductID, \
@@ -110,7 +110,7 @@ SELECT \
110
110
### Column Map
111
111
The wizard then generates the column bindings or column map. To fix several issues with some providers, the following code might bind columns in a different order than that reported by the provider.
@@ -140,7 +140,7 @@ class CProducts : public CCommand<CAccessor<CProductsAccessor>>
140
140
141
141
In the following example, the wizard generates a declaration for the class `COrders`, but the user record class `COrdersAccessor` does not appear, because the attributes inject it.
Copy file name to clipboardExpand all lines: docs/data/oledb/consumer-wizard-generated-methods.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,15 +28,15 @@ The ATL OLE DB Consumer Wizard and the MFC Application Wizard generate certain f
28
28
29
29
## OpenAll and CloseAll
30
30
31
-
```
31
+
```cpp
32
32
HRESULT OpenAll();
33
33
34
34
voidCloseAll();
35
35
```
36
36
37
-
The following example shows how you can call `OpenAll` and `CloseAll` when you execute the same command repeatedly. Compare the code example in [CCommand::Close](../../data/oledb/ccommand-close.md), which shows a variation that calls **Close** and `ReleaseCommand` instead of `CloseAll`.
37
+
The following example shows how you can call `OpenAll` and `CloseAll` when you execute the same command repeatedly. Compare the code example in [CCommand::Close](../../data/oledb/ccommand-close.md), which shows a variation that calls `Close` and `ReleaseCommand` instead of `CloseAll`.
38
38
39
-
```
39
+
```cpp
40
40
intmain(int argc, char* argv[])
41
41
{
42
42
HRESULT hr;
@@ -72,14 +72,14 @@ int main(int argc, char* argv[])
**OpenAll** calls this method to open the rowset or rowsets in the consumer. Typically, you do not need to call `OpenRowset` unless you want to work with multiple data sources/sessions/rowsets. `OpenRowset` is declared in the command or table class header file:
82
+
`OpenAll` calls this method to open the rowset or rowsets in the consumer. Typically, you do not need to call `OpenRowset` unless you want to work with multiple data sources/sessions/rowsets. `OpenRowset` is declared in the command or table class header file:
The attributes implement this method differently. This version takes a session object and a command string that defaults to the command string specified in db_command, although you can pass a different one. Note that if you define a `HasBookmark` method, the `OpenRowset` code sets the DBPROP_IRowsetLocate property; make sure you only do this if your provider supports that property.
This method retrieves a pointer to the rowset's property set; you can use this pointer to set properties such as DBPROP_IRowsetChange. `GetRowsetProperties` is used in the user record class as follows. You can modify this code to set additional rowset properties:
Copy file name to clipboardExpand all lines: docs/data/oledb/creating-a-consumer-without-using-a-wizard.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ The following example assumes that you are adding OLE DB consumer support to an
18
18
19
19
- In your Stdafx.h file, append the following `#include` statements:
20
20
21
-
```
21
+
```cpp
22
22
#include<atlbase.h>
23
23
#include<atldbcli.h>
24
24
#include<atldbsch.h>// if you are using schema templates
@@ -33,23 +33,23 @@ The following example assumes that you are adding OLE DB consumer support to an
33
33
34
34
- Instantiate a data source and a session. Decide what type of accessor and rowset to use and then instantiate a rowset using [CCommand](../../data/oledb/ccommand-class.md) or [CTable](../../data/oledb/ctable-class.md):
- Call **CoInitialize** to initialize COM. This is usually called in the main code. For example:
42
+
- Call `CoInitialize` to initialize COM. This is usually called in the main code. For example:
43
43
44
-
```
44
+
```cpp
45
45
HRESULT hr = CoInitialize(NULL);
46
46
```
47
47
48
48
- Call [CDataSource::Open](../../data/oledb/cdatasource-open.md) or one of its variations.
49
49
50
50
- Open a connection to the data source, open the session, and open and initialize the rowset (and if a command, also execute it):
51
51
52
-
```
52
+
```cpp
53
53
hr = ds.Open();
54
54
hr = ss.Open(ds);
55
55
hr = rs.Open(); // (Open also executes the command)
@@ -61,15 +61,15 @@ The following example assumes that you are adding OLE DB consumer support to an
61
61
62
62
- When your application is done, close the connection, session, and rowset:
63
63
64
-
```
64
+
```cpp
65
65
rs.Close();
66
66
ss.Close();
67
67
ds.Close();
68
68
```
69
69
70
-
If you are using a command, you might want to call `ReleaseCommand` after **Close**. The code example in [CCommand::Close](../../data/oledb/ccommand-close.md) shows how to call **Close** and `ReleaseCommand`.
70
+
If you are using a command, you might want to call `ReleaseCommand` after `Close`. The code example in [CCommand::Close](../../data/oledb/ccommand-close.md) shows how to call `Close`and `ReleaseCommand`.
71
71
72
-
- Call **CoUnInitialize** to uninitialize COM. This is usually called in the main code.
72
+
- Call `CoUnInitialize` to uninitialize COM. This is usually called in the main code.
Copy file name to clipboardExpand all lines: docs/data/oledb/creating-an-updatable-provider.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Visual C++ supports updatable providers or providers that can update (write to)
17
17
18
18
This topic assumes that you are starting with a workable provider. There are two steps to creating an updatable provider. You must first decide how the provider will make changes to the data store; specifically, whether changes are to be done immediately or deferred until an update command is issued. The section "[Making Providers Updatable](#vchowmakingprovidersupdatable)" describes the changes and settings you need to do in the provider code.
19
19
20
-
Next, you must make sure your provider contains all the functionality to support anything the consumer might request of it. If the consumer wants to update the data store, the provider has to contain code that persists data to the data store. For example, you might use the C Run-Time Library or MFC to perform such operations on your data source. The section "[Writing to the Data Source](#vchowwritingtothedatasource)" describes how to write to the data source, deal with `NULL` and default values, and set column flags.
20
+
Next, you must make sure your provider contains all the functionality to support anything the consumer might request of it. If the consumer wants to update the data store, the provider has to contain code that persists data to the data store. For example, you might use the C Run-Time Library or MFC to perform such operations on your data source. The section "[Writing to the Data Source](#vchowwritingtothedatasource)" describes how to write to the data source, deal with NULL and default values, and set column flags.
21
21
22
22
> [!NOTE]
23
23
> UpdatePV is an example of an updatable provider. UpdatePV is the same as MyProv but with updatable support.
@@ -42,7 +42,7 @@ Visual C++ supports updatable providers or providers that can update (write to)
42
42
43
43
Add `IRowsetChangeImpl` to your inheritance chain using this form:
44
44
45
-
```
45
+
```cpp
46
46
IRowsetChangeImpl< rowset-name, storage-name >
47
47
```
48
48
@@ -52,7 +52,7 @@ Visual C++ supports updatable providers or providers that can update (write to)
52
52
53
53
Add `IRowsetUpdate` to your inheritance chain using this form:
54
54
55
-
```
55
+
```cpp
56
56
IRowsetUpdateImpl< rowset-name, storage>
57
57
```
58
58
@@ -75,7 +75,7 @@ Visual C++ supports updatable providers or providers that can update (write to)
75
75
76
76
4. In your property set map, you should also include all of the following settings as they appear below:
0 commit comments