Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. DataSet ds = new DataSet();
  2. ds.ReadXml("C:\sites.xml");
  3.  
  4. dataGridView1.DataSource = ds.Tables[0];
  5.  
  6. this.dataGridView1.Columns[1].Visible = false;
  7.  
  8. //filter
  9. ds.Tables[0].DefaultView.RowFilter = "date = '" + DateTime.Now.ToString() + "'";
  10.  
  11. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  12. <sites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  13. <site technical="1">
  14. <name>brian</name>
  15. <url>www.microsoft.com</url>
  16. <date>01/02/2012</date>
  17. </site>
  18. <site technical="2">
  19. <name>Mike</name>
  20. <url>www.news.com</url>
  21. <date>01/02/2012</date>
  22. </site>
  23. <site technical="3">
  24. <name>leslie</name>
  25. <url>www.cnet.com</url>
  26. <date>02/01/2012</date>
  27. </site>
  28. <site technical="4">
  29. <name>rebeca</name>
  30. <url>www.gamespot.com</url>
  31. <date>01/01/2012</date>
  32. </site>
  33. <site technical="5">
  34. <name>jenifer</name>
  35. <url>www.google.com</url>
  36. <date>02/01/2012</date>
  37. </site>
  38. </sites>
  39.  
  40. ds.Tables[0].DefaultView.RowFilter = "date = #" + DateTime.Now.ToString() + "#";
  41.  
  42. ds.Tables[0].DefaultView.RowFilter = "date = #" + DateTime.Now.ToString("MM/dd/yyyy") + "#";
  43.  
  44. ds.Tables[0].DefaultView.RowFilter = "date = #" + DateTime.Now.ToString() + "#";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement