Skip to content

Data.ExecuteDataTable

Igor Tkachev edited this page May 20, 2016 · 1 revision

Home / Data

ExecuteDataTable.cs

using System;
using System.Data;

using NUnit.Framework;

using BLToolkit.Data;

namespace HowTo.Data
{
    [TestFixture]
    public class ExecuteDataTable
    {
        [Test]
        public void Test()
        {
            using (DbManager db = new DbManager())
            {
                DataTable dt = db
                    .SetCommand("SELECT * FROM Person")
                    .ExecuteDataTable();

                Assert.AreNotEqual(0, dt.Rows.Count);
            }
        }
    }
}

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>
Clone this wiki locally