mirror of
https://github.com/PetroProtsyk/SSharp
synced 2026-06-08 12:11:10 +00:00
19 lines
643 B
Plaintext
19 lines
643 B
Plaintext
//Script.NET examples
|
|
//(c)2007-2009, Protsyk Petro, http://www.protsyk.com
|
|
|
|
sql = DbProviderFactories.GetFactory("System.Data.SqlClient");
|
|
connection = sql.CreateConnection();
|
|
connection.ConnectionString = "Data Source=PPROTSYK\\SQLEXPRESS;Initial Catalog=TestBase;Integrated Security=True";
|
|
connection.Open();
|
|
|
|
command = sql.CreateCommand();
|
|
command.Connection = connection;
|
|
command.CommandText = "select * from Table_1";
|
|
|
|
|
|
reader = command.ExecuteReader();
|
|
while (reader.Read())
|
|
{
|
|
Console.WriteLine(reader["ID"]+". "+ reader["Name"]);
|
|
}
|
|
connection.Dispose(); |