473,406 Members | 2,345 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,406 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 2751
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.