[Mono-dev] Re: Invalid escape selecting table rows

APS subscription.sapi at apsystems.it
Fri Jun 9 03:20:21 EDT 2006


I explained me in a bad way.

(PAGE='\wsngmono\Categ.aspx' OR PAGE='/wsngmono/Categ.aspx') AND 
(CONTROL='' OR CONTROL IS NULL) AND ENABLED=0

is the search I want to do, I want to search a string containing 
'\wsngmono\categ.aspx'

In c# code I've done

Tables[0].Select("(PAGE='\\wsngmono\\Categ.aspx' OR 
PAGE='/wsngmono/Categ.aspx') AND (CONTROL='' OR CONTROL IS NULL) AND 
ENABLED=0")

otherwise there would be a compilation error.
I think that replacing '\' with '\\' it's wrong cause it would search 
a string with a double '\' in it, btw I tried with

Tables[0].Select("(PAGE='\\\\wsngmono\\\\Categ.aspx' OR 
PAGE='/wsngmono/Categ.aspx') AND (CONTROL='' OR CONTROL IS NULL) AND 
ENABLED=0")

and the error change..but not much

System.Data.SyntaxErrorException: Invalid escape sequence: '\w'

Maybe mono understand '\' in sql code as escape sequence?
Thanks in advance for helping me.


At 17.55 08/06/2006, Robert Jordan wrote:
>>I select them using
>>Tables[0].Select("(PAGE='\wsngmono\Categ.aspx' OR 
>>PAGE='/wsngmono/Categ.aspx') AND (CONTROL='' OR CONTROL IS NULL) 
>>AND ENABLED=0")
>>and I obtain this error:
>>System.Data.SyntaxErrorException: Invalid escape sequence: '\s'.
>>in <0x00118> Mono.Data.SqlExpressions.Tokenizer:ProcessEscapes (Char c)
>>in <0x000cc> Mono.Data.SqlExpressions.Tokenizer:ReadString (Char 
>>terminator, Boolean canEscape)
>>in <0x0015b> Mono.Data.SqlExpressions.Tokenizer:ParseToken ()
>>in <0x00030> Mono.Data.SqlExpressions.Tokenizer:advance ()
>>in <0x00274> Mono.Data.SqlExpressions.Parser:yyparse (yyInput yyLex)
>>in <0x00112> Mono.Data.SqlExpressions.Parser:Compile (System.String sqlExpr)
>>in <0x000dd> System.Data.DataTable:Select (System.String 
>>filterExpression, System.String sort, DataViewRowState recordStates)
>>in <0x00014> System.Data.DataTable:Select (System.String filterExpression)
>>Apparently there's no escape sequence in the query, I'm doing 
>>something wrong?
>
>
>Escape all "\" with "\\".
>
>Robert
>
>_______________________________________________
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list