diff --git a/daab/a00940.html b/daab/a00940.html
index 754b939..d8b8c71 100644
--- a/daab/a00940.html
+++ b/daab/a00940.html
@@ -94,7 +94,10 @@
Configuration
-Code Examples
+Code Examples
+
@@ -186,6 +189,8 @@
Code Examples
+
+Creating Database Instances
The simplest approach for creating a Database
object or one of its descendants is calling the CreateDefault
or Create
method of the DatabaseProviderFactory
class, as shown here, and storing these instances in application-wide variables so that they can be accessed from anywhere in the code.
DatabaseProviderFactory factory = new DatabaseProviderFactory();
@@ -204,6 +209,33 @@
sqlServerDB = DatabaseFactory.CreateDatabase() as SqlDatabase;
In addition to using configuration to define the databases you will use, the Data Access block allows you to create instances of concrete types that inherit from the Database class directly in your code, as shown here.
SqlDatabase sqlDatabase = new SqlDatabase(myConnectionString);
+
+Reading Rows Using a Query with No Parameters
+To read rows using a stored procedure with no parameters, retrieve an IDataReader
and read values from it:
+
using (IDataReader reader = namedDB.ExecuteReader("MyStoredProcName"))
+
{
+
+
DisplayRowValues(reader);
+
}
+
ExecuteReader
also accept a CommandType
, but the default value is CommandType.StoredProcedure
.
+To use an inline SQL statement, specify a CommandType.Text
:
+
+
using (IDataReader reader = namedDB.ExecuteReader(CommandType.Text, "SELECT TOP 1 * FROM OrderList"))
+
{
+
+
DisplayRowValues(reader);
+
}
+
private void DisplayRowValues(IDataReader reader)
+
{
+
while (reader.Read())
+
{
+
for (int i = 0; i < reader.FieldCount; i++)
+
{
+
Console.WriteLine("{0} = {1}", reader.GetName(i), reader[i].ToString());
+
}
+
Console.WriteLine();
+
}
+
}
diff --git a/daab/annotated_dup.js b/daab/annotated_dup.js
index 2469c19..aecc954 100644
--- a/daab/annotated_dup.js
+++ b/daab/annotated_dup.js
@@ -5,7 +5,10 @@ var annotated_dup =
[ "Configuration", "a00940.html#autotoc_md3", [
[ "Oracle Configuration", "a00940.html#autotoc_md4", null ]
] ],
- [ "Code Examples", "a00940.html#autotoc_md5", null ],
+ [ "Code Examples", "a00940.html#autotoc_md5", [
+ [ "Creating Database Instances", "a00940.html#autotoc_md6", null ],
+ [ "Reading Rows Using a Query with No Parameters", "a00940.html#autotoc_md7", null ]
+ ] ],
[ "Microsoft", "a00233.html", [
[ "Practices", "a00234.html", [
[ "EnterpriseLibrary", "a00235.html", [
diff --git a/daab/navtreedata.js b/daab/navtreedata.js
index d468caf..6d3d755 100644
--- a/daab/navtreedata.js
+++ b/daab/navtreedata.js
@@ -47,7 +47,7 @@ var NAVTREEINDEX =
"a00523.html#a9f8ee827a130d35f3cd1ae2b28eb0310",
"a00615.html#aec4e078b46f775b90d01038bab518c57",
"a00695.html#a27469f9c1ac7f0c4d1c86fdfc3000b0e",
-"functions_func_g.html"
+"functions_func_e.html"
];
var SYNCONMSG = 'click to disable panel synchronisation';
diff --git a/daab/navtreeindex4.js b/daab/navtreeindex4.js
index 416c44d..4f62d60 100644
--- a/daab/navtreeindex4.js
+++ b/daab/navtreeindex4.js
@@ -234,6 +234,8 @@ var NAVTREEINDEX4 =
"a00940.html#autotoc_md3":[2],
"a00940.html#autotoc_md4":[2,0],
"a00940.html#autotoc_md5":[3],
+"a00940.html#autotoc_md6":[3,0],
+"a00940.html#autotoc_md7":[3,1],
"annotated.html":[1,0],
"classes.html":[1,1],
"functions.html":[1,3,0,0],
@@ -247,7 +249,5 @@ var NAVTREEINDEX4 =
"functions_func.html":[1,3,1],
"functions_func_b.html":[1,3,1,1],
"functions_func_c.html":[1,3,1,2],
-"functions_func_d.html":[1,3,1,3],
-"functions_func_e.html":[1,3,1,4],
-"functions_func_f.html":[1,3,1,5]
+"functions_func_d.html":[1,3,1,3]
};
diff --git a/daab/navtreeindex5.js b/daab/navtreeindex5.js
index 1948a44..48709a2 100644
--- a/daab/navtreeindex5.js
+++ b/daab/navtreeindex5.js
@@ -1,5 +1,7 @@
var NAVTREEINDEX5 =
{
+"functions_func_e.html":[1,3,1,4],
+"functions_func_f.html":[1,3,1,5],
"functions_func_g.html":[1,3,1,6],
"functions_func_i.html":[1,3,1,7],
"functions_func_l.html":[1,3,1,8],