Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. string.Format("SELECT Count

string.Format("SELECT Count

Scheduled Pinned Locked Moved ASP.NET
graphicsdesignsysadminquestionworkspace
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ibuprofen
    wrote on last edited by
    #1

    Can someone tell me why my counting wont count correctly? 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 TCAIMS.Components; using System.Data.OleDb; using System.Configuration; namespace TCAIMS.NewDag { /// /// Summary description for QCData1. /// public class WorKiDAGData1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblErrorMsg; protected System.Web.UI.WebControls.DropDownList ddlForm; protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Panel Panel1; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1; protected System.Web.UI.WebControls.Label lblErrMsg; protected TCAIMS.Server.Navigator MenuNav; protected System.Web.UI.WebControls.Button TIR_Score; private string strConnection = ConfigurationSettings.AppSettings["TCAIMSDataCon"]; private void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; if(user.DAG.ToString() == "False") { Panel1.Visible=false; lblErrorMsg.Visible=true; } CountRecords(); } } private void CountRecords() { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); DataSet dsDagFlagCnt = new DataSet("dsDagFlagCnt"); DataTable tblDagFlags = new DataTable("tblDagFlags"); try { con.Open(); string[] list = {"DEMO", "Task_Questionnaire", "Software_Usability_Survey", "Test_Incident_Report", "Workstation_Profile", "t_EOT_IA", "t_EOT_SA", "t_EOT_Security", "t_EOT_SMEpart1", "t_EOT_SMEpart2", "t_EOT_User", "Equipment_Daily_Status"}; // dsDagFlagCnt.Tables.Add(tblDagFlags); tblDagFlags.Columns.Add("TableName", typeof(string)); tblDagFlags.Columns.Add("AECVote_NV", typeof(int)); tblDagFlags.Columns.Add("AECVote_P", typeof(int)); tblDagFlags.Columns.Add("AECVote_NA", typeof(int))

    P N C 3 Replies Last reply
    0
    • I Ibuprofen

      Can someone tell me why my counting wont count correctly? 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 TCAIMS.Components; using System.Data.OleDb; using System.Configuration; namespace TCAIMS.NewDag { /// /// Summary description for QCData1. /// public class WorKiDAGData1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblErrorMsg; protected System.Web.UI.WebControls.DropDownList ddlForm; protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Panel Panel1; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1; protected System.Web.UI.WebControls.Label lblErrMsg; protected TCAIMS.Server.Navigator MenuNav; protected System.Web.UI.WebControls.Button TIR_Score; private string strConnection = ConfigurationSettings.AppSettings["TCAIMSDataCon"]; private void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; if(user.DAG.ToString() == "False") { Panel1.Visible=false; lblErrorMsg.Visible=true; } CountRecords(); } } private void CountRecords() { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); DataSet dsDagFlagCnt = new DataSet("dsDagFlagCnt"); DataTable tblDagFlags = new DataTable("tblDagFlags"); try { con.Open(); string[] list = {"DEMO", "Task_Questionnaire", "Software_Usability_Survey", "Test_Incident_Report", "Workstation_Profile", "t_EOT_IA", "t_EOT_SA", "t_EOT_Security", "t_EOT_SMEpart1", "t_EOT_SMEpart2", "t_EOT_User", "Equipment_Daily_Status"}; // dsDagFlagCnt.Tables.Add(tblDagFlags); tblDagFlags.Columns.Add("TableName", typeof(string)); tblDagFlags.Columns.Add("AECVote_NV", typeof(int)); tblDagFlags.Columns.Add("AECVote_P", typeof(int)); tblDagFlags.Columns.Add("AECVote_NA", typeof(int))

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      I think you'll find few people who are going to read through the entire code of your page. Which bit in particular isn't working...?

      I 1 Reply Last reply
      0
      • I Ibuprofen

        Can someone tell me why my counting wont count correctly? 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 TCAIMS.Components; using System.Data.OleDb; using System.Configuration; namespace TCAIMS.NewDag { /// /// Summary description for QCData1. /// public class WorKiDAGData1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblErrorMsg; protected System.Web.UI.WebControls.DropDownList ddlForm; protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Panel Panel1; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1; protected System.Web.UI.WebControls.Label lblErrMsg; protected TCAIMS.Server.Navigator MenuNav; protected System.Web.UI.WebControls.Button TIR_Score; private string strConnection = ConfigurationSettings.AppSettings["TCAIMSDataCon"]; private void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; if(user.DAG.ToString() == "False") { Panel1.Visible=false; lblErrorMsg.Visible=true; } CountRecords(); } } private void CountRecords() { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); DataSet dsDagFlagCnt = new DataSet("dsDagFlagCnt"); DataTable tblDagFlags = new DataTable("tblDagFlags"); try { con.Open(); string[] list = {"DEMO", "Task_Questionnaire", "Software_Usability_Survey", "Test_Incident_Report", "Workstation_Profile", "t_EOT_IA", "t_EOT_SA", "t_EOT_Security", "t_EOT_SMEpart1", "t_EOT_SMEpart2", "t_EOT_User", "Equipment_Daily_Status"}; // dsDagFlagCnt.Tables.Add(tblDagFlags); tblDagFlags.Columns.Add("TableName", typeof(string)); tblDagFlags.Columns.Add("AECVote_NV", typeof(int)); tblDagFlags.Columns.Add("AECVote_P", typeof(int)); tblDagFlags.Columns.Add("AECVote_NA", typeof(int))

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        How a person can identify where you are wrong from such a lengthy code ?


        printf("Navaneeth!!") www.w3hearts.com

        I 1 Reply Last reply
        0
        • P Paddy Boyd

          I think you'll find few people who are going to read through the entire code of your page. Which bit in particular isn't working...?

          I Offline
          I Offline
          Ibuprofen
          wrote on last edited by
          #4

          It functions, but its not display accurate counts of my data in my tables. Is there a better way to do this?

          P 1 Reply Last reply
          0
          • N N a v a n e e t h

            How a person can identify where you are wrong from such a lengthy code ?


            printf("Navaneeth!!") www.w3hearts.com

            I Offline
            I Offline
            Ibuprofen
            wrote on last edited by
            #5

            More looking at getting some comments on a better way to do counting for certain critera, so I posted my whole code so everyone could see how I was doing it.

            1 Reply Last reply
            0
            • I Ibuprofen

              It functions, but its not display accurate counts of my data in my tables. Is there a better way to do this?

              P Offline
              P Offline
              Paddy Boyd
              wrote on last edited by
              #6

              In what way inaccurate, and is there a particular bit of the code that you are getting problems with?

              I 1 Reply Last reply
              0
              • P Paddy Boyd

                In what way inaccurate, and is there a particular bit of the code that you are getting problems with?

                I Offline
                I Offline
                Ibuprofen
                wrote on last edited by
                #7

                It's not counting my actual voted fields. All the counts end up as the total number of records in the db. Or some other crazy number.

                1 Reply Last reply
                0
                • I Ibuprofen

                  Can someone tell me why my counting wont count correctly? 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 TCAIMS.Components; using System.Data.OleDb; using System.Configuration; namespace TCAIMS.NewDag { /// /// Summary description for QCData1. /// public class WorKiDAGData1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Label lblErrorMsg; protected System.Web.UI.WebControls.DropDownList ddlForm; protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Panel Panel1; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1; protected System.Web.UI.WebControls.Label lblErrMsg; protected TCAIMS.Server.Navigator MenuNav; protected System.Web.UI.WebControls.Button TIR_Score; private string strConnection = ConfigurationSettings.AppSettings["TCAIMSDataCon"]; private void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack) { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; if(user.DAG.ToString() == "False") { Panel1.Visible=false; lblErrorMsg.Visible=true; } CountRecords(); } } private void CountRecords() { string connectionString = strConnection; OleDbConnection con = new OleDbConnection(connectionString); DataSet dsDagFlagCnt = new DataSet("dsDagFlagCnt"); DataTable tblDagFlags = new DataTable("tblDagFlags"); try { con.Open(); string[] list = {"DEMO", "Task_Questionnaire", "Software_Usability_Survey", "Test_Incident_Report", "Workstation_Profile", "t_EOT_IA", "t_EOT_SA", "t_EOT_Security", "t_EOT_SMEpart1", "t_EOT_SMEpart2", "t_EOT_User", "Equipment_Daily_Status"}; // dsDagFlagCnt.Tables.Add(tblDagFlags); tblDagFlags.Columns.Add("TableName", typeof(string)); tblDagFlags.Columns.Add("AECVote_NV", typeof(int)); tblDagFlags.Columns.Add("AECVote_P", typeof(int)); tblDagFlags.Columns.Add("AECVote_NA", typeof(int))

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  No-one is going to read all this, and without your DB, they cannot use it to try and reproduce the issue. Go into SQL Server and play with SQL until you find something that accurately counts your values. Then use that.

                  Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                  I 1 Reply Last reply
                  0
                  • C Christian Graus

                    No-one is going to read all this, and without your DB, they cannot use it to try and reproduce the issue. Go into SQL Server and play with SQL until you find something that accurately counts your values. Then use that.

                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                    I Offline
                    I Offline
                    Ibuprofen
                    wrote on last edited by
                    #9

                    Well, it truly does prove how much better it is to just have someone elses eyes on your code, I sent it to a friend and fellow programmer, and as he was reviewing it, I found my TYPO's. Fixed and counts were correct.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups