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. General Programming
  3. C#
  4. about DataRow

about DataRow

Scheduled Pinned Locked Moved C#
2 Posts 2 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.
  • C Offline
    C Offline
    clj19870503
    wrote on last edited by
    #1

    OleDbConnection thisConnection = new OleDbConnection( @"Provider = Microsoft.Jet.OLEDB.4.0;Data Source=e:\DataMoney.mdb"); OleDbDataAdapter thisAdapter = new OleDbDataAdapter( "SELECT * FROM SchoolMoney", thisConnection); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "SchoolMoney"); OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter); thisBuilder.QuotePrefix = "["; thisBuilder.QuoteSuffix = "]"; //set up keys object for defining primary key DataColumn[] keys = new DataColumn[1]; keys[0] = thisDataSet.Tables["SchoolMoney"].Columns[0]; thisDataSet.Tables["SchoolMoney"].PrimaryKey = keys; DataRow findRow = thisDataSet.Tables["SchoolMoney"].Rows.Find(this.textBox1.Text); if (findRow != null) { // } thisConnection.Close(); } } } can you tell me how i get the number of row about findRow thank you

    M 1 Reply Last reply
    0
    • C clj19870503

      OleDbConnection thisConnection = new OleDbConnection( @"Provider = Microsoft.Jet.OLEDB.4.0;Data Source=e:\DataMoney.mdb"); OleDbDataAdapter thisAdapter = new OleDbDataAdapter( "SELECT * FROM SchoolMoney", thisConnection); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "SchoolMoney"); OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter); thisBuilder.QuotePrefix = "["; thisBuilder.QuoteSuffix = "]"; //set up keys object for defining primary key DataColumn[] keys = new DataColumn[1]; keys[0] = thisDataSet.Tables["SchoolMoney"].Columns[0]; thisDataSet.Tables["SchoolMoney"].PrimaryKey = keys; DataRow findRow = thisDataSet.Tables["SchoolMoney"].Rows.Find(this.textBox1.Text); if (findRow != null) { // } thisConnection.Close(); } } } can you tell me how i get the number of row about findRow thank you

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      do you mean the index of the row that was found? if so use this line of code where your blank comment is... int rowNum = thisDataSet.Tables["SchoolMoney"].Rows.IndexOf(findRow);

      Life goes very fast. Tomorrow, today is already yesterday.

      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