Advertisement
Guest User

Untitled

a guest
Mar 5th, 2017
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. SqlConnection con = new SqlConnection("Server=.;Database=MinionsDB;Integrated Security=true;");
  4. con.Open();
  5. using (con)
  6. {
  7. string country = Console.ReadLine();
  8. string select = $"SELECT UPPER(TownName) FROM Towns WHERE CountryName = '{country}'";
  9. SqlCommand exec = new SqlCommand(select, con);
  10. SqlDataReader printscr = exec.ExecuteReader();
  11. Console.Write("[");
  12. while(printscr.Read())
  13. {
  14. Console.Write(printscr.GetString(0));
  15. }
  16. Console.Write("]");
  17. }
  18. con.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement