Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void RefreshTimer_Tick(object sender, EventArgs e)
- {
- List<String> dates = new List<String>();
- SqlConnection conn = new SqlConnection();
- conn.ConnectionString = "Data Source=80.82.149.94;Initial Catalog=udbstest;Persist Security Info=True;User ID=udbstest;Password=pass1234;Connection Timeout=5;";
- conn.Open();
- SqlCommand command = new SqlCommand("SELECT GETDATE() AS CurrentDateTime", conn);
- using (SqlDataReader reader = command.ExecuteReader())
- {
- while (reader.Read())
- {
- dates.Add(reader.GetDateTime(0).ToString());
- }
- }
- conn.Close();
- testgrid.DataSource = dates;
- testgrid.DataBind();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement