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

column.expression

Hi.

The following line gives me exception 'Cannot find column Motherboard'
(where ;Motherboard = itemsLB.SelectedItem.ToString())

itemsTable.Columns["Name"].Expression = itemsLB.SelectedItem.ToString();

Thanks.

Emil
May 4 '07 #1
3 3071
I changed the line to this:
itemsTable.Columns["Name"].Expression = "Name = '" +
itemsLB.SelectedItem.ToString() + "'";

I get an exception of Circular reference. How can I filter the table for a
criteria?

"EmilH" <em*****@yahoo.comwrote in message
news:uK**************@TK2MSFTNGP03.phx.gbl...
Hi.

The following line gives me exception 'Cannot find column Motherboard'
(where ;Motherboard = itemsLB.SelectedItem.ToString())

itemsTable.Columns["Name"].Expression = itemsLB.SelectedItem.ToString();

Thanks.

Emil


May 4 '07 #2
"EmilH" <em*****@yahoo.comwrote in message
news:uK**************@TK2MSFTNGP03.phx.gbl...
>Hi.

The following line gives me exception 'Cannot find column Motherboard'
(where ;Motherboard = itemsLB.SelectedItem.ToString())

itemsTable.Columns["Name"].Expression = itemsLB.SelectedItem.ToString();
* EmilH wrote, On 4-5-2007 10:04:
I changed the line to this:
itemsTable.Columns["Name"].Expression = "Name = '" +
itemsLB.SelectedItem.ToString() + "'";

I get an exception of Circular reference. How can I filter the table
for a
criteria?
You basically have two options here:

1) Use a Dataview
Dataview dv = new DataView(itemsTable, "Name = \"" +
itemsLB.SelectedItem.ToString(),"");

2) User Table.Select() to get the rows that match the criteria:
DataRow[] rows = itemsTable.Select(Name = \"" +
itemsLB.SelectedItem.ToString());

The Expression Property you're working with is not used to filter a
table, but to dynamically create a fieldvalue based on other data in the
table.

Jesse Houwing
May 4 '07 #3
Thanks Jesse!
"Jesse Houwing" <je***********@nospam-sogeti.nlwrote in message
news:%2*****************@TK2MSFTNGP05.phx.gbl...
>"EmilH" <em*****@yahoo.comwrote in message
news:uK**************@TK2MSFTNGP03.phx.gbl...
>>Hi.

The following line gives me exception 'Cannot find column Motherboard'
(where ;Motherboard = itemsLB.SelectedItem.ToString())

itemsTable.Columns["Name"].Expression = itemsLB.SelectedItem.ToString();
* EmilH wrote, On 4-5-2007 10:04:
I changed the line to this:
itemsTable.Columns["Name"].Expression = "Name = '" +
itemsLB.SelectedItem.ToString() + "'";

I get an exception of Circular reference. How can I filter the table
for a
criteria?

You basically have two options here:

1) Use a Dataview
Dataview dv = new DataView(itemsTable, "Name = \"" +
itemsLB.SelectedItem.ToString(),"");

2) User Table.Select() to get the rows that match the criteria:
DataRow[] rows = itemsTable.Select(Name = \"" +
itemsLB.SelectedItem.ToString());

The Expression Property you're working with is not used to filter a table,
but to dynamically create a fieldvalue based on other data in the table.

Jesse Houwing

May 4 '07 #4

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

Similar topics

4
by: Wiebke Pätzold | last post by:
Hi all! I create a database that contains a table. 'Nachname' is one of 13 column names. This program can search for a special letter. In my example it is 'ra'. and the search takes place in...
5
by: Ken1 | last post by:
I am going to drop a primary key from one column and create a new column to be used as primary key in an existing database. The old column was a date column which someone earlier though was a good...
10
by: GML | last post by:
I have a bound datagrid in C# based on an an SQL query. The results are displayed in a Sharepoint 2003 Webpart. I would like to add a new column based on the results of two columns in the...
4
by: perspolis | last post by:
I have 3 columns in my datatabel name Total,unit,Price. I use a column expression in my project..and in this expression i multiplied two column... for example ...
5
by: perspolis | last post by:
hi everyone I used a column expression like "UnitPrice*Quantity" for a cloumn named Total. but when I want to update my dataset by SqlDataAdopter, it gives me error. The column Total is just for...
3
by: Reney | last post by:
I am using Access in my project. In one of the forms, I am calling two tables, and two of the columns have date/time type, namely "ClockIn" and "ClockOut". I created a dataset and filled the...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
2
by: Dot Net Daddy | last post by:
Hello, I want to assign a column a computed value, which is the multiplication of a value from the table within and a value from another table. How can I do that?
2
by: Ken B | last post by:
How can I make a datagrid column into a single row that spans all the other columns? In this case I have a comment field that I want to make as wide as the table but I cannot figure out how to...
0
by: SMH | last post by:
Hi All, I am currently learning .Net 2, studying for 70-528. I've hit a bit of a brick wall with DataColumn.Expression. As I understand it, this can be used to (For example) concatenate two...
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: 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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.