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-methods.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
68
68
}
69
69
```
70
70
71
-
## Remarks
71
+
### Remarks
72
72
73
73
If you define a `HasBookmark` method, the `OpenAll` code sets the `DBPROP_IRowsetLocate` property; make sure you only do this if your provider supports that property.
You shouldn't define a global `GetRowsetProperties` method because it could conflict with the one defined by the wizard. This is a wizard-generated method that you get with templated and attributed projects; the attributes don't inject this code.
139
139
@@ -145,7 +145,7 @@ HRESULT OpenDataSource();
145
145
voidCloseDataSource();
146
146
```
147
147
148
-
## Remarks
148
+
###Remarks
149
149
150
150
The wizard defines the methods `OpenDataSource` and `CloseDataSource`; `OpenDataSource` calls [CDataSource::OpenFromInitializationString](../../data/oledb/cdatasource-openfrominitializationstring.md).
Before calling a stored procedure, you must first define it, using the [DEFINE_COMMAND](../../data/oledb/define-command.md) macro. When you define the command, denote parameters with a question mark (?) as the parameter marker:
17
17
18
18
```cpp
19
-
DEFINE_COMMAND(CMySProcAccessor, _T("{INSERT {name, phone} into shippers (?,?)}")
19
+
DEFINE_COMMAND_EX(CMySProcAccessor, _T("{INSERT {name, phone} INTO shippers (?,?)}"))
20
20
```
21
21
22
22
The syntax (the use of braces, and so on) used in the code examples in this topic is specific to SQL Server. The syntax that you use in your stored procedures might vary according to the provider you use.
@@ -35,8 +35,8 @@ END_PARAM_MAP()
35
35
The previous example defines a stored procedure as it goes. Typically, for efficient reuse of code, a database contains a set of predefined stored procedures with names such as `Sales by Year` or `dt_adduserobject`. You can view their definitions using SQL Server Enterprise Manager. You call them as follows (the placement of the *?* parameters depend on the stored procedure's interface):
36
36
37
37
```cpp
38
-
DEFINE_COMMAND(CMySProcAccessor, _T("{CALL \"Sales by Year\" (?,?) }")
// Check the product name isn't NULL before tracing it
111
-
if (product.nNameStatus == DBSTATUS_S_OK)
112
-
ATLTRACE("%s is %d characters\n", szName, nNameLength);
113
-
}
114
-
```
88
+
- Then, access the length and/or status as shown:
89
+
90
+
```cpp
91
+
CTable<CAccessor<CProducts >> product;
92
+
CSession session;
93
+
94
+
product.Open(session, "Product");
95
+
96
+
while (product.MoveNext() == S_OK)
97
+
{
98
+
// Check the product name isn't NULL before tracing it
99
+
if (product.nNameStatus == DBSTATUS_S_OK)
100
+
ATLTRACE("%s is %d characters\n", product.szName, product.nNameLength);
101
+
}
102
+
```
115
103
116
104
When you use `CDynamicAccessor`, the length and status are bound for you automatically. To retrieve the length and status values, use the `GetLength` and `GetStatus` member functions.
Copy file name to clipboardExpand all lines: docs/data/oledb/obtaining-metadata-with-schema-rowsets.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
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Obtaining Metadata with Schema Rowsets | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "10/24/2018"
5
5
ms.technology: ["cpp-data"]
6
6
ms.topic: "reference"
7
7
dev_langs: ["C++"]
@@ -37,7 +37,7 @@ ANSI SQL defines a catalog/schema model for data stores; OLE DB uses this model.
37
37
When you query for schema information, you can use restrictions to specify the type of information in which you're interested. You can think of restrictions as a filter or qualifier in a query. For example, in the query:
38
38
39
39
```sql
40
-
SELECT*FROM authors where l_name ='pivo'
40
+
SELECT*FROM authors WHERE l_name ='pivo'
41
41
```
42
42
43
43
`l_name` is a restriction. This is a simple example with only one restriction; the schema rowset classes support several restrictions.
@@ -64,15 +64,15 @@ So, for example, if you want to restrict by table name, TABLE_NAME is the third
64
64
CDataSource ds;
65
65
ds.Open();
66
66
CSession ss;
67
-
ss.Open();
68
-
CColumns ColumnSchemaRowset;
67
+
ss.Open(ds);
68
+
CColumns columnSchemaRowset;
69
69
// TABLE_NAME is the third restriction column, so
70
70
// specify "authors" as the third restriction parameter:
0 commit comments