473,395 Members | 1,554 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,395 software developers and data experts.

DataView

This is a rehash of a response question I made down below.

I am playing with the NorthWind database. I have created a DataSet and
loaded the Employees table into it. I have created a DataView on that
table.

Now, I am having trouble putting all the parts together to retrieve a single
row of that DataView. For instance, if I want to retrieve the row where
EmployeeId='2' and display the FirstName of that employee, what steps do I
need to perform? What I've tried keeps getting syntax errors or exceptions.

For instance, both

dataView1.RowFilter="EmployeeId != '2'";
dataView1.RowFilter="EmployeeId != 2"; // No single quotes

Gives me the error:

Cannot interpret token '!' at position 12.

Since the filter removes the rows that match the contition, I have to
negate the condition to get the data I want.

I'd appreciate some help.

Thanx,
Bill
Nov 17 '05 #1
6 2749
Bill,

Why would it be != when = is the equal operator and not ==.

The unequal operator is <>
http://msdn.microsoft.com/library/de...ssiontopic.asp

I hope this helps,

Cor

Nov 17 '05 #2
Thanks again. Mind is on other things I guess. Anyway, additional details
on the steps would be very helpful.
Nov 17 '05 #3

As I play with this, I find that a table automatically has a defaultview
that can be used. Therefore, using a DataView does not appear to be
necessary. I think I am I making progress here.
Nov 17 '05 #4
Bill,

You mean
dataView1.RowFilter = "EmployeeId='2'"
string MyFirstName = dataView1.Item[0]["FirstName"];
Cor
Nov 17 '05 #5
Right,
Nov 17 '05 #6
That's it. It was too simple to figure out except Item wasn't recognzed.
Had to use:

string MyFirstName=dataView1[0]["FirstName"].ToString();

Thank you much,
Bill

Nov 17 '05 #7

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

Similar topics

2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
5
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it...
0
by: Pravin Pujari | last post by:
Hi All, I am using .net framework 1.1 and c#. I have one problem regarding dataview. I have one dataview to which sorting may be applied or may not be applied. I have one UI component where I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.