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. Mobile Development
  3. Mobile
  4. Windows Mobile 5 / SQL Mobile Record Counts

Windows Mobile 5 / SQL Mobile Record Counts

Scheduled Pinned Locked Moved Mobile
databasehelpquestion
2 Posts 1 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

    private void R1RecCount() { if (RAMDataSetUtil.DesignerUtil.IsRunTime()) { R1Count.Visible = true; conn = new SqlCeConnection("Data Source = \\My Documents\\RAM.sdf"); conn.Open(); SqlCeCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT COUNT ([StatusCode]) FROM R1Time"; SqlCeDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { count = count + 1; if (count >= 1) { //MessageBox.Show(rdr.GetValue(0).ToString()); //Eventually will ad button to this screen this.rAMDataSet.R1Time.AddR1TimeRow( rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString()); } } } this.r1TimeTableAdapter.Fill(this.rAMDataSet.R1Time); conn.Close(); } This doesn't seem to count? I also tried creating a new query in the Dataset, doing a count like SELECT COUNT(1) AS R1 FROM R1Time then calling it as the fill. Thanks for your help! Paul

    I 1 Reply Last reply
    0
    • I Ibuprofen

      private void R1RecCount() { if (RAMDataSetUtil.DesignerUtil.IsRunTime()) { R1Count.Visible = true; conn = new SqlCeConnection("Data Source = \\My Documents\\RAM.sdf"); conn.Open(); SqlCeCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT COUNT ([StatusCode]) FROM R1Time"; SqlCeDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { count = count + 1; if (count >= 1) { //MessageBox.Show(rdr.GetValue(0).ToString()); //Eventually will ad button to this screen this.rAMDataSet.R1Time.AddR1TimeRow( rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString()); } } } this.r1TimeTableAdapter.Fill(this.rAMDataSet.R1Time); conn.Close(); } This doesn't seem to count? I also tried creating a new query in the Dataset, doing a count like SELECT COUNT(1) AS R1 FROM R1Time then calling it as the fill. Thanks for your help! Paul

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

      Well I know I didn't do it the correct way.. However it does work... private void R1RecCount() { R1Count.Visible = false; conn = new SqlCeConnection("Data Source = \\My Documents\\RAM.sdf"); conn.Open(); SqlCeCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM R1Time"; SqlCeDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { countr1 = countr1 + 1; if (countr1 >= 1) { //MessageBox.Show(rdr.GetValue(0).ToString()); //Eventually will ad button to this screen this.rAMDataSet.R1Time.AddR1TimeRow( rdr.GetValue(0).ToString(), rdr.GetValue(1).ToString(), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString()); } } R1c.Text = countr1.ToString(); R1c.Enabled = false; this.r1TimeTableAdapter.Fill(this.rAMDataSet.R1Time); conn.Close(); }

      Computer Programmer Web/Mobile .NET

      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