static void Main(string[] args)
{
string connectionString = GetConnectionString();
using (SqlConnection connection = new SqlConnection(connectionString))
{
// Connect to the database then retrieve the schema information.
connection.Open();
DataTable table = connection.GetSchema("Procedures");
// Display the contents of the table.
DisplayData(table);
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
}
}
private static string GetConnectionString()
{
// To avoid storing the connection string in your code,
// you can retrieve it from a configuration file.
return "Data Source=<servername>;Database=<database>;Integrated Security=SSPI;";
}
private static void DisplayData(System.Data.DataTable table)
{
foreach (System.Data.DataRow row in table.Rows)
{
foreach (System.Data.DataColumn col in table.Columns)
{
Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);
}
Console.WriteLine("============================");
}
}
DotNetZip revs to v1.6 – now with Unicode support (0) | 2009.02.20 |
---|---|
.Net Zip Library (0) | 2009.02.20 |
이벤트 동시 등록하는 방법 (0) | 2008.06.18 |
ADO.NET DB연결 문자열 (0) | 2008.06.18 |
Bulk Insert into SQL from C# App (0) | 2008.06.18 |