Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.SqlClient;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- SqlConnection connection = new SqlConnection();
- connection.ConnectionString = "Server=LAB-418-09-PC; Database=master; Integrated Security=True";
- connection.Open();
- Console.WriteLine(connection.State);
- SqlCommand command = new SqlCommand();
- command.Connection = connection;
- command.CommandText = "SELECT * FROM [master].[dbo].[spt_values] ORDER BY number DESC";
- SqlDataReader reader = command.ExecuteReader();
- while (reader.Read())
- {
- Console.WriteLine(reader["name"].ToString());
- }
- reader.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment