Advertisement
Guest User

Untitled

a guest
Apr 18th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Text;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Data.SqlClient;
  9. using System.Configuration;
  10.  
  11. public partial class rozpis : System.Web.UI.Page
  12. {
  13. StringBuilder table = new StringBuilder();
  14.  
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. SqlConnection cn = new SqlConnection("Server=mssql02.qsh.eu,1481;User=db1017552-hokej;Password=Hokej_okhs2017;Database=db1017552-hokej");
  18. cn.Open();
  19. SqlCommand cmd = new SqlCommand();
  20. cmd.CommandText = "select * from Rozpis ORDER BY ID";
  21. cmd.Connection = cn;
  22. SqlDataReader rd = cmd.ExecuteReader();
  23. table.Append("<table class='rozpis' style='color: white; width: 50%; '>");
  24. table.Append("<tr style='text-align:center; height: 30px; background-color: #FFF; border: 2px solid white; font-family:Impact;'>");
  25. table.Append("<td style = 'width: 40px; border-right:1px solid #999;' ><font color='black' > Kolo </font></td>");
  26. table.Append("<td style = 'width: 80px; border-right:1px solid #999;' ><font color='black' > Dátum </font></td>");
  27. table.Append("<td style = 'width: 80px; border-right:1px solid #999;' ><font color='black' > Čas </font></td>");
  28. table.Append("<td style = 'width: 80px; border-right:1px solid #999;' ><font color='black' > Miesto </font></td>");
  29. table.Append("<td style = 'width: 100px; border-right:1px solid #999;' ><font color='black' > Domáci </font></td>");
  30. table.Append("<td style = 'width: 100px; border-right:1px solid #999;' ><font color='black' > Hostia </font ></td>");
  31. table.Append("<td style = 'width: 100px;' ><font color='black' > Výsledok </font ></td>");
  32. table.Append("</tr>");
  33.  
  34. if (rd.HasRows)
  35. {
  36. while(rd.Read())
  37. {
  38. table.Append("<tr >");
  39. table.Append("<td style='border-right:1px solid white;border-radius:0px; text-align:center;' rowspan='3' >" + rd[1] + "</td>");
  40. table.Append("<td style='text-align:center; border-right:1px solid white;' rowspan='3'>" + rd[2] + "</td>");
  41. while (rd.Read())
  42. {
  43. table.Append("<td style='text-align:center; border-right:1px solid white;border-radius:0px;'>" + rd[3] + "</td>");
  44. table.Append("<td style='text-align:center; border-right:1px solid white;'>" + rd[4] + "</td>");
  45. table.Append("<td style='border-right:1px solid white;'>" + rd[5] + "</td>");
  46. table.Append("<td style=' border-right:1px solid white;'>" + rd[6] + "</td>");
  47. table.Append("<td style='border-radius:0px;'>" + rd[7] + "</td>");
  48. table.Append("</tr>");
  49. }
  50. }
  51. }
  52. table.Append("</table>");
  53. Rozpis.Controls.Add(new Literal { Text = table.ToString() });
  54. rd.Close();
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement