Skip to content

Commit 1d47dad

Browse files
author
mtx48109
committed
odbc formatting review pr7
1 parent bbc6cd2 commit 1d47dad

11 files changed

+75
-75
lines changed

docs/data/odbc/recordset-parameterizing-a-recordset-odbc.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ This topic applies to the MFC ODBC classes.
3333

3434
- It lets you build a query at run time, based on information not available to you at design time, such as information obtained from your user or calculated at run time.
3535

36-
When you call **Open** to run the query, the recordset uses the parameter information to complete its **SQL SELECT** statement. You can parameterize any recordset.
36+
When you call `Open` to run the query, the recordset uses the parameter information to complete its **SQL SELECT** statement. You can parameterize any recordset.
3737

3838
## <a name="_core_when_to_use_parameters"></a> When to Use Parameters
3939
Typical uses for parameters include:
4040

4141
- Passing run-time arguments to a predefined query.
4242

43-
To pass parameters to a stored procedure, you must specify a complete custom ODBC **CALL** statement — with parameter placeholders — when you call **Open**, overriding the recordset's default SQL statement. For more information, see [CRecordset::Open](../../mfc/reference/crecordset-class.md#open) in the *Class Library Reference* and [SQL: Customizing Your Recordset's SQL Statement (ODBC)](../../data/odbc/sql-customizing-your-recordsets-sql-statement-odbc.md) and [Recordset: Declaring a Class for a Predefined Query (ODBC)](../../data/odbc/recordset-declaring-a-class-for-a-predefined-query-odbc.md).
43+
To pass parameters to a stored procedure, you must specify a complete custom ODBC **CALL** statement — with parameter placeholders — when you call `Open`, overriding the recordset's default SQL statement. For more information, see [CRecordset::Open](../../mfc/reference/crecordset-class.md#open) in the *Class Library Reference* and [SQL: Customizing Your Recordset's SQL Statement (ODBC)](../../data/odbc/sql-customizing-your-recordsets-sql-statement-odbc.md) and [Recordset: Declaring a Class for a Predefined Query (ODBC)](../../data/odbc/recordset-declaring-a-class-for-a-predefined-query-odbc.md).
4444

4545

4646
- Efficiently performing numerous requeries with different parameter information.
4747

48-
For example, each time your end user looks up information for a particular student in the student registration database, you can specify the student's name or ID as a parameter obtained from the user. Then, when you call your recordset's **Requery** member function, the query selects only that student's record.
48+
For example, each time your end user looks up information for a particular student in the student registration database, you can specify the student's name or ID as a parameter obtained from the user. Then, when you call your recordset's `Requery` member function, the query selects only that student's record.
4949

50-
Your recordset's filter string, stored in **m_strFilter**, might look like this:
50+
Your recordset's filter string, stored in `m_strFilter`, might look like this:
5151

5252
```
5353
"StudentID = ?"
@@ -75,7 +75,7 @@ This topic applies to the MFC ODBC classes.
7575
The parameter value is different each time you requery the recordset for a new student ID.
7676
7777
> [!TIP]
78-
> Using a parameter is more efficient than simply a filter. For a parameterized recordset, the database must process a SQL **SELECT** statement only once. For a filtered recordset without parameters, the **SELECT** statement must be processed each time you **Requery** with a new filter value.
78+
> Using a parameter is more efficient than simply a filter. For a parameterized recordset, the database must process a SQL **SELECT** statement only once. For a filtered recordset without parameters, the **SELECT** statement must be processed each time you `Requery` with a new filter value.
7979
8080
For more information about filters, see [Recordset: Filtering Records (ODBC)](../../data/odbc/recordset-filtering-records-odbc.md).
8181
@@ -94,7 +94,7 @@ This topic applies to the MFC ODBC classes.
9494
9595
3. After the wizard writes the class to a file in your project, go to the .h file and manually add one or more parameter data members to the class declaration. The addition might look something like the following example, part of a snapshot class designed to answer the query "Which students are in the senior class?"
9696
97-
```
97+
```cpp
9898
class CStudentSet : public CRecordset
9999
{
100100
// Field/Param Data
@@ -132,21 +132,21 @@ This topic applies to the MFC ODBC classes.
132132
> The most likely string to work with is the string you specify (if any) for the class's [m_strFilter](../../mfc/reference/crecordset-class.md#m_strfilter) data member, but some ODBC drivers might allow parameters in other SQL clauses.
133133
134134
## <a name="_core_passing_parameter_values_at_run_time"></a> Passing Parameter Values at Run Time
135-
You must specify parameter values before you call **Open** (for a new recordset object) or **Requery** (for an existing one).
135+
You must specify parameter values before you call `Open` (for a new recordset object) or `Requery` (for an existing one).
136136
137137
#### To pass parameter values to a recordset object at run time
138138
139139
1. Construct the recordset object.
140140
141-
2. Prepare a string or strings, such as the **m_strFilter** string, containing the SQL statement, or parts of it. Put "?" placeholders where the parameter information is to go.
141+
2. Prepare a string or strings, such as the `m_strFilter` string, containing the SQL statement, or parts of it. Put "?" placeholders where the parameter information is to go.
142142
143143
3. Assign a run-time parameter value to each parameter data member of the object.
144144
145-
4. Call the **Open** member function (or **Requery**, for an existing recordset).
145+
4. Call the `Open` member function (or `Requery`, for an existing recordset).
146146
147147
For example, suppose you want to specify a filter string for your recordset using information obtained at run time. Assume you have constructed a recordset of class `CStudentSet` earlier — called `rsStudents` — and now want to requery it for a particular kind of student information.
148148
149-
```
149+
```cpp
150150
// Set up a filter string with
151151
// parameter placeholders
152152
rsStudents.m_strFilter = "GradYear <= ?";

docs/data/odbc/recordset-requerying-a-recordset-odbc.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This topic applies to the MFC ODBC classes.
2929
Another frequent — and equally important — use of [Requery](../../mfc/reference/crecordset-class.md#requery) is to select a new set of records based on changing parameter values.
3030

3131
> [!TIP]
32-
> Query speed is probably significantly faster if you call **Requery** with changing parameter values than if you call **Open** again.
32+
> Query speed is probably significantly faster if you call `Requery` with changing parameter values than if you call `Open` again.
3333
3434
## <a name="_core_requerying_dynasets_vs.._snapshots"></a> Requerying Dynasets vs. Snapshots
3535
Because dynasets are meant to present a set of records with dynamic up-to-date data, you want to requery dynasets often if you want to reflect other users' additions. Snapshots, on the other hand, are useful because you can safely rely on their static contents while you prepare reports, calculate totals, and so on. Still, you might sometimes want to requery a snapshot as well. In a multiuser environment, snapshot data might lose synchronization with the data source as other users change the database.
@@ -43,9 +43,9 @@ This topic applies to the MFC ODBC classes.
4343
For an example, see [Record Views: Filling a List Box from a Second Recordset](../../data/filling-a-list-box-from-a-second-recordset-mfc-data-access.md).
4444

4545
> [!TIP]
46-
> To optimize **Requery** performance, avoid changing the recordset's [filter](../../data/odbc/recordset-filtering-records-odbc.md) or [sort](../../data/odbc/recordset-sorting-records-odbc.md). Change only the parameter value before calling **Requery**.
46+
> To optimize `Requery` performance, avoid changing the recordset's [filter](../../data/odbc/recordset-filtering-records-odbc.md) or [sort](../../data/odbc/recordset-sorting-records-odbc.md). Change only the parameter value before calling `Requery`.
4747
48-
If the **Requery** call fails, you can retry the call; otherwise, your application should terminate gracefully. A call to **Requery** or **Open** might fail for any of a number of reasons. Perhaps a network error occurs; or, during the call, after the existing data is released but before the new data is obtained, another user might get exclusive access; or the table on which your recordset depends could be deleted.
48+
If the `Requery` call fails, you can retry the call; otherwise, your application should terminate gracefully. A call to `Requery` or `Open` might fail for any of a number of reasons. Perhaps a network error occurs; or, during the call, after the existing data is released but before the new data is obtained, another user might get exclusive access; or the table on which your recordset depends could be deleted.
4949

5050
## See Also
5151
[Recordset (ODBC)](../../data/odbc/recordset-odbc.md)

docs/data/odbc/recordset-scrolling-odbc.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ This topic applies to the MFC ODBC classes.
2323
- [Under what circumstances scrolling is and is not supported](#_core_when_scrolling_is_supported).
2424

2525
## <a name="_core_scrolling_from_one_record_to_another"></a> Scrolling from One Record to Another
26-
Class `CRecordset` provides the **Move** member functions for scrolling within a recordset. These functions move the current record by rowsets. If you have implemented bulk row fetching, a **Move** operation repositions the recordset by the size of the rowset. If you have not implemented bulk row fetching, a call to a **Move** function repositions the recordset by one record each time. For more information about bulk row fetching, see [Recordset: Fetching Records in Bulk (ODBC)](../../data/odbc/recordset-fetching-records-in-bulk-odbc.md).
26+
Class `CRecordset` provides the `Move` member functions for scrolling within a recordset. These functions move the current record by rowsets. If you have implemented bulk row fetching, a `Move` operation repositions the recordset by the size of the rowset. If you have not implemented bulk row fetching, a call to a `Move` function repositions the recordset by one record each time. For more information about bulk row fetching, see [Recordset: Fetching Records in Bulk (ODBC)](../../data/odbc/recordset-fetching-records-in-bulk-odbc.md).
2727

2828
> [!NOTE]
2929
> When moving through a recordset, deleted records might not be skipped. For more information, see the [IsDeleted](../../mfc/reference/crecordset-class.md#isdeleted) member function.
3030
31-
In addition to the **Move** functions, `CRecordset` provides member functions for checking whether you have scrolled past the end or ahead of the beginning of your recordset.
31+
In addition to the `Move` functions, `CRecordset` provides member functions for checking whether you have scrolled past the end or ahead of the beginning of your recordset.
3232

3333
To determine whether scrolling is possible in your recordset, call the `CanScroll` member function.
3434

@@ -78,18 +78,18 @@ while( !rsCustSet.IsBOF( ) )
7878
rsCustSet.MoveFirst( );
7979
```
8080

81-
`IsEOF` returns a nonzero value if the recordset is positioned past the last record. `IsBOF` returns a nonzero value if the recordset is positioned ahead of the first record (before all records). In either case, there is no current record to operate on. If you call `MovePrev` when `IsBOF` is already **TRUE** or call `MoveNext` when `IsEOF` is already **TRUE**, the framework throws a `CDBException`. You can also use `IsBOF` and `IsEOF` to check for an empty recordset.
81+
`IsEOF` returns a nonzero value if the recordset is positioned past the last record. `IsBOF` returns a nonzero value if the recordset is positioned ahead of the first record (before all records). In either case, there is no current record to operate on. If you call `MovePrev` when `IsBOF` is already TRUE or call `MoveNext` when `IsEOF` is already TRUE, the framework throws a `CDBException`. You can also use `IsBOF` and `IsEOF` to check for an empty recordset.
8282

8383
For more information about recordset navigation, see [Recordset: Bookmarks and Absolute Positions (ODBC)](../../data/odbc/recordset-bookmarks-and-absolute-positions-odbc.md).
8484

8585
## <a name="_core_when_scrolling_is_supported"></a> When Scrolling Is Supported
8686
As originally designed, SQL provided only forward scrolling, but ODBC extends scrolling capabilities. The available level of support for scrolling depends on the ODBC drivers your application works with, your driver's ODBC API conformance level, and whether the ODBC Cursor Library is loaded into memory. For more information, see [ODBC](../../data/odbc/odbc-basics.md) and [ODBC: The ODBC Cursor Library](../../data/odbc/odbc-the-odbc-cursor-library.md).
8787

8888
> [!TIP]
89-
> You can control whether the cursor library is used. See the `bUseCursorLib` and `dwOptions` parameters to [CDatabase::Open](../../mfc/reference/cdatabase-class.md#open).
89+
> You can control whether the cursor library is used. See the *bUseCursorLib* and *dwOptions* parameters to [CDatabase::Open](../../mfc/reference/cdatabase-class.md#open).
9090
9191
> [!NOTE]
92-
> Unlike the MFC DAO classes, the MFC ODBC classes do not provide a set of **Find** functions for locating the next (or previous) record that meets specified criteria.
92+
> Unlike the MFC DAO classes, the MFC ODBC classes do not provide a set of `Find` functions for locating the next (or previous) record that meets specified criteria.
9393
9494
## See Also
9595
[Recordset (ODBC)](../../data/odbc/recordset-odbc.md)

docs/data/odbc/recordset-sorting-records-odbc.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ ms.workload: ["cplusplus", "data-storage"]
1414
# Recordset: Sorting Records (ODBC)
1515
This topic applies to the MFC ODBC classes.
1616

17-
This topic explains how to sort your recordset. You can specify one or more columns on which to base the sort, and you can specify ascending or descending order (`ASC` or **DESC**; `ASC` is the default) for each specified column. For example, if you specify two columns, the records are sorted first on the first column named and then on the second column named. A SQL **ORDER BY** clause defines a sort. When the framework appends the **ORDER BY** clause to the recordset's SQL query, the clause controls the selection's ordering.
17+
This topic explains how to sort your recordset. You can specify one or more columns on which to base the sort, and you can specify ascending or descending order (**ASC** or **DESC**; **ASC** is the default) for each specified column. For example, if you specify two columns, the records are sorted first on the first column named and then on the second column named. A SQL **ORDER BY** clause defines a sort. When the framework appends the **ORDER BY** clause to the recordset's SQL query, the clause controls the selection's ordering.
1818

19-
You must establish a recordset's sort order after you construct the object but before you call its **Open** member function (or before you call the **Requery** member function for an existing recordset object whose **Open** member function has been called previously).
19+
You must establish a recordset's sort order after you construct the object but before you call its `Open` member function (or before you call the `Requery` member function for an existing recordset object whose `Open` member function has been called previously).
2020

2121
#### To specify a sort order for a recordset object
2222

23-
1. Construct a new recordset object (or prepare to call **Requery** for an existing one).
23+
1. Construct a new recordset object (or prepare to call `Requery` for an existing one).
2424

2525
2. Set the value of the object's [m_strSort](../../mfc/reference/crecordset-class.md#m_strsort) data member.
2626

@@ -38,11 +38,11 @@ This topic applies to the MFC ODBC classes.
3838
3939
3. Set any other options you need, such as a filter, locking mode, or parameters.
4040
41-
4. Call **Open** for the new object (or **Requery** for an existing object).
41+
4. Call `Open` for the new object (or `Requery` for an existing object).
4242
4343
The selected records are ordered as specified. For example, to sort a set of student records in descending order by last name, then first name, do the following:
4444
45-
```
45+
```cpp
4646
// Construct the recordset
4747
CStudentSet rsStudent( NULL );
4848
// Set the sort
@@ -54,7 +54,7 @@ rsStudent.Open( );
5454
The recordset contains all of the student records, sorted in descending order (Z to A) by last name, then by first name.
5555

5656
> [!NOTE]
57-
> If you choose to override the recordset's default SQL string by passing your own SQL string to **Open**, do not set a sort if your custom string has an **ORDER BY** clause.
57+
> If you choose to override the recordset's default SQL string by passing your own SQL string to `Open`, do not set a sort if your custom string has an **ORDER BY** clause.
5858
5959
## See Also
6060
[Recordset (ODBC)](../../data/odbc/recordset-odbc.md)

docs/data/odbc/recordset-working-with-large-data-items-odbc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This topic applies to both the MFC ODBC classes and the MFC DAO classes.
4848
In turn, you use the `HGLOBAL` handle, `m_hData`, to work with the data itself, operating on it as you would on any handle data. This is where [CByteArray](../../mfc/reference/cbytearray-class.md) adds capabilities.
4949

5050
> [!CAUTION]
51-
> CLongBinary objects cannot be used as parameters in function calls. In addition, their implementation, which calls **::SQLGetData**, necessarily slows scrolling performance for a scrollable snapshot. This might also be true when you use an **::SQLGetData** call yourself to retrieve dynamic schema columns.
51+
> CLongBinary objects cannot be used as parameters in function calls. In addition, their implementation, which calls `::SQLGetData`, necessarily slows scrolling performance for a scrollable snapshot. This might also be true when you use an `::SQLGetData` call yourself to retrieve dynamic schema columns.
5252
5353
## See Also
5454
[Recordset (ODBC)](../../data/odbc/recordset-odbc.md)

0 commit comments

Comments
 (0)