Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- SqlConnection con = new SqlConnection("Server=.;Database=MinionsDB;Integrated Security=true;");
- con.Open();
- using (con)
- {
- string country = Console.ReadLine();
- string select = $"SELECT UPPER(TownName) FROM Towns WHERE CountryName = '{country}'";
- SqlCommand exec = new SqlCommand(select, con);
- SqlDataReader printscr = exec.ExecuteReader();
- Console.Write("[");
- while(printscr.Read())
- {
- Console.Write(printscr.GetString(0));
- }
- Console.Write("]");
- }
- con.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement