-
Notifications
You must be signed in to change notification settings - Fork 113
Data.ExecuteReader
Igor Tkachev edited this page May 20, 2016
·
1 revision
ExecuteReader.cs
using System;
using System.Data;
using NUnit.Framework;
using BLToolkit.Data;
namespace HowTo.Data
{
[TestFixture]
public class ExecuteReader
{
[Test]
public void Test()
{
using (DbManager db = new DbManager())
{
db.SetCommand("SELECT * FROM Person");
using (IDataReader rd = db.ExecuteReader())
{
while (rd.Read())
{
// ...
}
}
}
}
}
}
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add
name = "DemoConnection"
connectionString = "Server=.;Database=BLToolkitData;Integrated Security=SSPI"
providerName = "System.Data.SqlClient" />
</connectionStrings>
</configuration>