473,326 Members | 2,012 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,326 software developers and data experts.

dataview rowfiltering question

Hi,
I am trying to put a filter on a dataview. the column has [] in its name, it
is called - tml.[TYPE_CHAR]
i tried escaping the column name as per the MSDN help - [tml.[TYPE_CHR\]]
However i get a compilre error - "unrecognised escape sequence"
Can anyone point out what I'm doing wrong ??

Thanks
Aniket

the code is -
private const string TML_TYPE_COL = "[tml.[TYPE_CHR\]]";
string Filter = TML_TYPE_COL + " ='Active' ";
_dataView.RowFilter = Filter;


Nov 15 '05 #1
3 1537
Aniket Sule wrote:
Hi,
I am trying to put a filter on a dataview. the column has [] in its
name, it is called - tml.[TYPE_CHAR]
i tried escaping the column name as per the MSDN help -
[tml.[TYPE_CHR\]] However i get a compilre error - "unrecognised
escape sequence"
Can anyone point out what I'm doing wrong ??


If you have access to the database, I'd recommend changing the field
name. Otherwise, have you tried @"tml.[TYPE_CHAR]"?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #2
I tried using @"tml.[TYPE_CHR]", which throws an error saying "Cannot locate
column tml.TYPE_CHR". Its getting rid of the [] while trying to look for the
column for some reason.
I could access teh underlying dataset column and change the column name if
none of this works, but i was hoping to avoid that.

Thanks for the help
Aniket

"Frank Oquendo" <fr*******@acadx.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Aniket Sule wrote:
Hi,
I am trying to put a filter on a dataview. the column has [] in its
name, it is called - tml.[TYPE_CHAR]
i tried escaping the column name as per the MSDN help -
[tml.[TYPE_CHR\]] However i get a compilre error - "unrecognised
escape sequence"
Can anyone point out what I'm doing wrong ??


If you have access to the database, I'd recommend changing the field
name. Otherwise, have you tried @"tml.[TYPE_CHAR]"?

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 15 '05 #3
Hi,

You can try to trick the system by defining the square brackets by their
numerical codes in a form of \0xnnnn. You can also try to double the both
square brackets (that is, [[TYPE_CHR]]). The best advice would be to refer
to the MSDN docs on the DataColumn.Expression property syntax, there's a
chance such issues are explained there.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Nov 15 '05 #4

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

Similar topics

4
by: Martin Schmid | last post by:
I am trying to implement a DataView for a DataGrid so I can sort at runtime by clicking on column headers. My initial page load works... it displays the data However, when I click a column...
6
by: Joe | last post by:
I have a DataView and would like to extract data from it and write it to a ListView. Can I only accomplish this with the DataViewRows Object array? Is there a way forme to enumerate through the...
3
by: Jonathan Allen | last post by:
What could cause a stack trace like this? Message:Object reference not set to an instance of an object. Stack Trace: at System.Data.DataView.GetRecord(Int32 recordIndex) at...
20
by: Mark | last post by:
Hi all, quick question , a DataView is memory resident "view" of data in a data table therefore once populated you can close the connection to the database. Garbage collection can then be used to...
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...
14
by: Able | last post by:
Dear friends Dim myDataView as DataView = New DataView(dsData.Tables("tblCustomers")) myDataView.RowFilter = "City = 'London'" My question is how to loop through all rows in myDataView and...
10
by: Marc R. | last post by:
Hi all, I edit records using a form that have multiple control bind on Dataview, But I don't want to update right always to database, I would like to delay until all Changes (add all new...
4
by: James | last post by:
Basically I have a DataGrid that I'm binding to the results of a stored procedure call. The recordset is fairly small. Initially I'm creating a DataSet from the results and binding it. There's a...
7
by: Bernie Hunt | last post by:
I'm having trouble getting rowfiltering to work on my dataview. I have two dataviews, one with a list of shows (dvAllShows) and the other with a list of shows attended by a person(dvAttendedShows)....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.