Hi, I've got an SQL query string that works fine getting info from a back end Access database from an ASP.Net page. However I've found one of the query fields could contain illegal characters. I've managed to work out how to replace the ' character, but not the & character. What should I do?
Example:
lifecycle = lifecycle.Replace("'", "''")
selectCommandString = "Select Quotes.QuoteID from Quotes WHERE Lifecycle='" + lifecycle + "'"
If the lifecycle variable contains the ampersand character for example "A&W" the selectCommandString looks like this:
"Select Quotes.QuoteID from Quotes WHERE Lifecycle='A'"
How do I get round this?
Thanks in advance
Julia
Example:
lifecycle = lifecycle.Replace("'", "''")
selectCommandString = "Select Quotes.QuoteID from Quotes WHERE Lifecycle='" + lifecycle + "'"
If the lifecycle variable contains the ampersand character for example "A&W" the selectCommandString looks like this:
"Select Quotes.QuoteID from Quotes WHERE Lifecycle='A'"
How do I get round this?
Thanks in advance
Julia