Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to Spell-Out C# Cursor Position in DataTable?

Posted on 2012-08-22
Medium Priority
Last Modified: 2012-08-23
I am writing a database program in C# using Microsoft Access. I have a lot of code written.

I am need of knowing exactly how to spell out an instruction that returns the integer position of the last row fetched with the Find() operation.

Can anyone quickly spell this out for me?
Question by:Leonard Gojer
  • 2
LVL 96

Expert Comment

by:Bob Learned
ID: 38325540
That is not possible with the current state of the DataTable/DataRow.  You would have to do some custom work, to create an extended DataRow class to store the row index.  I did it in the past, although I don't have access to that code anymore.

Author Comment

by:Leonard Gojer
ID: 38325598
Question #1: "What is an extended DataRow?"

Question #2: "How does the extended DataRow store the row index?"

Question #3: "Can you direct me to web literature about this topic so that I can get
some ideas of how I write the coding myself?"
LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 38325718
An extended DataRow class would inherit from DataRow, and add an additional RowIndex property, but unfortunately the DataTable and DataRow classes are not designed very well to extend.

Here is an example:

Not sure how to inherit DataRow correctly...

public class MyObj
	public class DataTable : Data.DataTable

		protected override DataRow NewRowFromBuilder(DataRowBuilder builder)
			return new MyObj.DataRow(builder);

		public MyObj.DataRow this[int index] {
			get { return (MyObj.DataRow)this.Rows(index); }

		public void TrySomethingCool()

	public class DataRow : Data.DataRow

		private MyObj.DataTable _datatable;
		internal DataRow(DataRowBuilder rb) : base(rb)
			this._datatable = (MyObj.DataTable)this.Table;

		public void DoMyThing()

Open in new window


Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question