I want to store a sql query in app.config file which has < and > characters but file shows error 'expecting >' , have you come across this problem ?
Use " & " instead of "&".
Using configuration files in DLL is not trivial, but is very simple. Using configuration files in DLL is not trivial.
Just change the <
and >
to <
and >.
If you indeed need to put that query in the app.config, you can put it inside a CDATA section or you can escape those characters with <
and >
First, if you're storing SQL in the app.config you're probably doing something wrong. As @ChrisBint said, you should probably put this in an embedded resource file instead.
That being said, you should be able to correct the problem by replacing any special characters with a proper entity:
< ... <
> ... >
" ... "
Store the SQL in a resource file rather than the app.config.
(greater-than character) use ">"
Must be used for an attribute value, but > is acceptable as the content of an element as long as < does not precede it.
< (less-than character) - use "<"
Must be used for an attribute value, but < is acceptable as the content of an element as long as > does not follow it.
source - http://msdn.microsoft.com/en-us/library/ms748250.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With