using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; namespace XReports { /// /// Summary description for versiontotal1. /// public class versiontotal1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Table tblUploads; private void Page_Load(object sender, System.EventArgs e) { SqlConnection cn = new SqlConnection("Persist Security Info=False;Pwd=ocarpts@2;User ID=ocarpts;Initial Catalog=SnapShot;Data Source=TimRagain06"); SqlCommand cm = new SqlCommand(); SqlDataReader dr; DateTime dDate = DateTime.Now; int rowCtr=0; int cellCtr=0; int cellCnt = 3; cn.Open(); cm.CommandType = CommandType.StoredProcedure; cm.CommandTimeout = 240; cm.CommandText = "spVersionTotal"; cm.Connection = cn; dr = cm.ExecuteReader(); // dr.Read(); //for(rowCtr=0; rowCtr <= rowCnt; rowCtr++) do { TableRow tRow = new TableRow(); tblUploads.Rows.Add(tRow); for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++) { TableCell tCell = new TableCell(); if(rowCtr == 0) { switch(cellCtr) { case 1 : tCell.Text = "Total"; break; case 2 : tCell.Text = "OS Name"; break; case 3 : tCell.Text = "OS Version"; break; default: tCell.Text = ""; break; } tCell.Style["font-size"] = "small"; } else { switch(cellCtr) { case 1 : tCell.Text = dr.GetInt32(0).ToString(); break; case 2 : tCell.Text = dr.GetString(1); break; case 3 : tCell.Text = dr.GetString(2); break; default: tCell.Text = "0"; break; } tCell.Style["background-color"] = "white"; tCell.Style["font-size"] = "small-x"; tCell.Style["color"] = "#6487dc"; tCell.Style["font-weight"] = "Bold"; } tCell.Style["font-family"] = "Tahoma"; tRow.Cells.Add(tCell); } rowCtr++; }while(dr.Read() == true); } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion } }