Mike Cole
Mike Cole

Reputation: 14753

Escaping MySQL characters in .NET

Does anybody have any good .NET functions they can share to escape necessary MySQL query characters?

Thanks!

Upvotes: 0

Views: 964

Answers (2)

Michael Baker
Michael Baker

Reputation: 3434

Could you give an example of the necessary characters? Without a context...you could try using "@" to give a literal string.

string query= @"select * from table"

Otherwise there is String.Replace().

Upvotes: 0

bobbymcr
bobbymcr

Reputation: 24177

Shouldn't you be using the MySQL Connector/NET? If you need to do something like parameterized queries, then it should provide "safe" and correct ways to do it, e.g. in this example.

Upvotes: 7

Related Questions