c# - Mysql WHERE LIKE with RadCombobox.Text -
i having trouble select due use of @.
using
string mysql = "select * sytransactioncategory transactioncategory '%' + @transactioncategory + '%'";
do not work.
i found several interesting answers, this did not not manage adapt case. here current c# code:
string mysql = "select * sytransactioncategory transactioncategory @transactioncategory"; mysqldataadapter adapter = new mysqldataadapter(mysql,configurationmanager.connectionstrings["defaultconnection"].connectionstring); adapter.selectcommand.parameters.addwithvalue("@transactioncategory", e.text);
anyone give me track please?
the +
operator in mysql works on numbers.
you want ... concat('%', transactioncategory, '%')
if you're trying construct strings in query.
the kicker this: 0 + 'somethingrandom'
has result value of zero, because mysql tries convert 'somethingrandom'
integer, , decides it's zero.
0 + '2randomthings'
has value of 2.
so, query saying where column 0
- doesn't fail throwing kind of syntax error.
- doesn't find useful.
debugging kind of stuff in mysql pain in synt*x
Comments
Post a Comment