[MySQL] Error - DB _E_PARAMNOTOPTIONAL
Okay, in my c# application i am running a query (Using OleDB) such as
Code:
UPDATE `users` SET `pm` = 'Hello World!' WHERE `ID` = '1'
which works perfectly fine, however when i set it as something such as
Code:
UPDATE `users` SET `pm` = '???' WHERE `ID` = '1'
It gives me the error
{System.Data.OleDb.OleDbException: 'MySQLProv' failed with no error message available, result code: DB_E_PARAMNOTOPTIONAL(0x80040E10).
I've tried escaping out all question marks (Replacing ? with /?) but that doesn't want to work either.
Anybody care to offer any advice, etc on how i might overcome it? :P
~ Jeax
Re: [MySQL] Error - DB _E_PARAMNOTOPTIONAL
Hmm weird, apparently '?' is interprented as an optional parameter.
You can replace it by another value (like the ~) and then when you read from the db translate the ~ into ?. However, there must be a way you can escape/quote it...
Re: [MySQL] Error - DB _E_PARAMNOTOPTIONAL
Yeah i was thinking of just a simple replacement however that means that some character is not going to be able to be recognised, and its a bit of a pain! :tongue:
But if its the only way i can deal with it, then i guess i'm going to have to.
i tried to escape it (As i said) and it just gave me the same error, so i've got no idea whats going on.
Re: [MySQL] Error - DB _E_PARAMNOTOPTIONAL
You can replace it by some unprintable character. Like 0x02 (I dont know what char that is, but you get the point ;))...
Re: [MySQL] Error - DB _E_PARAMNOTOPTIONAL
??? a question mark in both C# and Java is interpreted as a SQL placeholder. When using question marks the compiler assumes your a putting in a value that will later be assiged by a prepared statement. So either use escape codes for the question mark, or simply set the value in the question mark to a question mark using prepared statements.
The key words to search for in the context are "PreparedStatements" or "C# SQL Escape Codes"
=p