|
using System;
using System.Data;
using System.Data.SqlClient;
namespace SQLSPPerformanceComparison
{
class SQLServerUtility
{
public static DataTable GetADataTable(SqlCommand cmd)
{
// Create a connection object and obtain the connection string from App.config file
SqlConnection connection = new SqlConnection();
connection.ConnectionString =
System.Configuration.ConfigurationSettings.AppSettings["SQLServerConnectionString"];
cmd.Connection = connection;
cmd.CommandTimeout = 0;
connection.Open();
DataTable aTable = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
adapter.Fill(aTable);
return aTable;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have been working in the IT industry for some time. It is still exciting and I am still learning. I am a happy and honest person, and I want to be your friend.