Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Text;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data.SqlClient;
- using System.Configuration;
- public partial class rozpis : System.Web.UI.Page
- {
- StringBuilder table = new StringBuilder();
- protected void Page_Load(object sender, EventArgs e)
- {
- SqlConnection cn = new SqlConnection("Server=mssql02.qsh.eu,1481;User=db1017552-hokej;Password=Hokej_okhs2017;Database=db1017552-hokej");
- cn.Open();
- SqlCommand cmd = new SqlCommand();
- cmd.CommandText = "select * from Rozpis ORDER BY ID";
- cmd.Connection = cn;
- SqlDataReader rd = cmd.ExecuteReader();
- table.Append("<table class='rozpis' style='color: white; width: 50%; '>");
- table.Append("<tr style='text-align:center; height: 30px; background-color: #FFF; border: 2px solid white; font-family:Impact;'>");
- table.Append("<td style = 'width: 40px; border-right:1px solid #999;' ><font color='black' > Kolo </font></td>");
- table.Append("<td style = 'width: 80px; border-right:1px solid #999;' ><font color='black' > Dátum </font></td>");
- table.Append("<td style = 'width: 80px; border-right:1px solid #999;' ><font color='black' > Čas </font></td>");
- table.Append("<td style = 'width: 80px; border-right:1px solid #999;' ><font color='black' > Miesto </font></td>");
- table.Append("<td style = 'width: 100px; border-right:1px solid #999;' ><font color='black' > Domáci </font></td>");
- table.Append("<td style = 'width: 100px; border-right:1px solid #999;' ><font color='black' > Hostia </font ></td>");
- table.Append("<td style = 'width: 100px;' ><font color='black' > Výsledok </font ></td>");
- table.Append("</tr>");
- if (rd.HasRows)
- {
- while(rd.Read())
- {
- table.Append("<tr >");
- table.Append("<td style='border-right:1px solid white;border-radius:0px; text-align:center;' rowspan='3' >" + rd[1] + "</td>");
- table.Append("<td style='text-align:center; border-right:1px solid white;' rowspan='3'>" + rd[2] + "</td>");
- while (rd.Read())
- {
- table.Append("<td style='text-align:center; border-right:1px solid white;border-radius:0px;'>" + rd[3] + "</td>");
- table.Append("<td style='text-align:center; border-right:1px solid white;'>" + rd[4] + "</td>");
- table.Append("<td style='border-right:1px solid white;'>" + rd[5] + "</td>");
- table.Append("<td style=' border-right:1px solid white;'>" + rd[6] + "</td>");
- table.Append("<td style='border-radius:0px;'>" + rd[7] + "</td>");
- table.Append("</tr>");
- }
- }
- }
- table.Append("</table>");
- Rozpis.Controls.Add(new Literal { Text = table.ToString() });
- rd.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement