Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string connStr = @"Data Source=(localdb)\v11.0;Initial Catalog = Movies;User Id = moviesuser;Password = qwerty123";
- SqlConnection conn = new SqlConnection(); ;
- SqlCommand cmd = new SqlCommand();
- using (conn = new SqlConnection(connStr))
- {
- //conn.Open();
- cmd = new SqlCommand("SELECT * FROM Videos", conn);
- try
- {
- conn.Open();
- DataTable dt = new DataTable("Video");
- dt.Load(cmd.ExecuteReader());
- dataGridView1.DataSource = dt;
- dt.WriteXml(@"C:\Users\Wojtek\Desktop\data.xml");
- }
- catch (Exception)
- {
- throw;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement