Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 14th, 2009, 04:25 AM
Authorized User
 
Join Date: Mar 2005
Location: Bangalore, Karnataka, India.
Posts: 36
Thanks: 2
Thanked 1 Time in 1 Post
Default System.Data.EvaluateException

Hello,
I have a requirement, where in user types in a value and I use this value to filter my datatable and show the records to the user.
Below is the query.

strQueryExpression = "GradeDesc LIKE '" + strValue + "%'"; //strValue = the typed in value.
drFilteredRows = dtSourceDataTable.Select(strQueryExpression );


While testing I typed a text like this "Shell[%%" and I got exceptions as below.
System.Data.EvaluateException Message: Error in Like operator: the string pattern 'Shell[%%' is invalid. Data: System.Collections.ListDictionaryInternal InnerException: NULL TargetSite: System.String AnalizePattern(System.String)

After analyzing and searching I found some solutions. Now I am replacing some of the characters woth proper escape characters. as below.

strValue = e.Text.Trim().Replace("'", "''");
strValue = strValue.Replace("[", "[[]");

But this is defenitely not sufficient.

For example when I type "Shell&*" or "Shell&" it works fine but when I type like this "Shell*&" this through the exception. How can I make handle these combination of characters?
Can any one help me in this regard?
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Data.OleDb.OleDbException: No value given f tjgrindsted ASP.NET 2.0 Basics 0 January 24th, 2007 07:25 AM
System Data Types liamfitz Beginning VB 6 0 October 17th, 2006 05:31 PM
System.Data.SqlClient.SqlException kbarsi Beginning VB 6 2 August 13th, 2005 09:39 PM
Need Help in System.Data.SQL vavre ADO.NET 2 August 24th, 2003 10:28 AM
'System.Data.ConstraintException' - HELP PLEASE AlanBell ADO.NET 1 July 1st, 2003 02:23 AM



All times are GMT -4. The time now is 11:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.