Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;Integrated Security=True;AttachDbFilename=c:usersnamedocumentsvisual studio 2013ProjectsDBSampleDBSampleDatabase1.mdf");
- SqlCommand cmd = new SqlCommand("Select * From Account", con);
- SqlDataReader rd= cmd.ExecuteReader(); ;
- SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;Integrated Security=True;AttachDbFilename=c:usersnamedocumentsvisual studio 2013ProjectsDBSampleDBSampleDatabase1.mdf");
- SqlCommand cmd = new SqlCommand("Select * From Account", con);
- con.Open();
- SqlDataReader rd= cmd.ExecuteReader();
- using (SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;Integrated Security=True;AttachDbFilename=c:usersnamedocumentsvisual studio 2013ProjectsDBSampleDBSampleDatabase1.mdf"))
- {
- using (SqlCommand cmd = new SqlCommand("Select * From Account", con))
- {
- // here the connection opens
- con.Open();
- using (SqlDataReader rd = cmd.ExecuteReader())
- {
- // do your data reading here
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement