Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Data.SqlClient;
- namespace LocalDBTest
- {
- class Program
- {
- static void Main(string[] args)
- {
- SqlConnection conn = new SqlConnection(@"Data Source=(localdb)\TestDB; Initial Catalog=APP_DATA; Integrated Security=false;user id=" + "Admin" + ";password=" + "ironrhino420");
- SqlCommand command = new SqlCommand("Select * From Test", conn);
- conn.Open();
- SqlDataReader reader = command.ExecuteReader();
- try
- {
- while (reader.Read())
- {
- Console.WriteLine("Successful Connection");
- Console.WriteLine(String.Format("{0}, {1}",
- reader["Column1"], reader["Column2"]));
- }
- }
- finally
- {
- reader.Close();
- }
- Console.WriteLine("Hello World!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement