473,327 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Row index

dir sir

I made a database contains a table named CONTACTS has the following attributes (Cont_id, Cont_Name, Address, Email, ...
In my application I have the value of the Cont_id, and I want to get the Index of the row(in the dataSet) that contains that Cont_i
(I`ve used OleDBDataAdapter and dataSet to connect to the database
How can I do that??!

thank
Mohamme
Nov 16 '05 #1
2 4074
Mohammed,

Unfortunately, there is not. You would have to cycle through the rows,
performing a comparison, and then noting the index of the row where you
found the values that matched.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mohammed Abdel-Razzak" <an*******@discussions.microsoft.com> wrote in
message news:F7**********************************@microsof t.com...
dir sirs

I made a database contains a table named CONTACTS has the following attributes (Cont_id, Cont_Name, Address, Email, ...) In my application I have the value of the Cont_id, and I want to get the Index of the row(in the dataSet) that contains that Cont_id (I`ve used OleDBDataAdapter and dataSet to connect to the database)
How can I do that??!!

thanks
Mohammed

Nov 16 '05 #2
Try this:

int contactId = 0;
DataRow dr = dataSet.Tables["Contacts"].Select(string.Format("Cont_di =
{0}", contactId))[0];

That should get you the DataRow that you are looking for, as for the index
of the actual row itself, there isn't a way to do it.

HTH,
Bill P.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Of**************@TK2MSFTNGP09.phx.gbl...
Mohammed,

Unfortunately, there is not. You would have to cycle through the rows, performing a comparison, and then noting the index of the row where you
found the values that matched.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mohammed Abdel-Razzak" <an*******@discussions.microsoft.com> wrote in
message news:F7**********************************@microsof t.com...
dir sirs

I made a database contains a table named CONTACTS has the following

attributes (Cont_id, Cont_Name, Address, Email, ...)
In my application I have the value of the Cont_id, and I want to get the

Index of the row(in the dataSet) that contains that Cont_id
(I`ve used OleDBDataAdapter and dataSet to connect to the database)
How can I do that??!!

thanks
Mohammed


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jofio | last post by:
Hello, I am a newbie in PHP and I am enthusiastically trying out things. I've just replaced my index.html ( file with index.php
9
by: kosh | last post by:
I was wondering if there is or there could be some way to pass a generator an optional starting index so that if it supported that slicing could be made more efficient. Right now if you do use a...
2
by: skura | last post by:
I am trying to understand how the data in sql server is stored and also regarding fill factor and page splitting. 1) My first question what is the difference between Index pages and Data pages....
6
by: Anita | last post by:
I have just tested 3 queries using QA. The complete test information : ------ CREATE TABLE agls1 ( fyear char(4) NULL , fprefix char(3) NULL , fvcno char(20) NULL , fdate datetime NULL ,...
8
by: Andr? Queiroz | last post by:
Hi, I have a table with 10M records and col A has a index created on it. The data on that table has the same value for col A on all 10M records. After that I insert diferent values for that column...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
4
by: Steph. | last post by:
I have a List view displaying data in Detail mode with several columns. How I can get the column index the user clicked on ? (when user click on an item inside the ListView, not on a column...
2
by: bobby_b_ | last post by:
I have a table where fields 1 and 2 make up the primary key. Because of this, I have a unique composite index on fields 1 and 2 (as required by DB2). Now my question is: Fields 1 and 2 are also...
85
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the...
8
by: shira | last post by:
I have done a fair bit of searching, but haven't yet been able to find an explanation as to why one would set "ignore nulls" to "yes" when creating an index. I understand what it does (I think),...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.