i have looked @ number of questions/answers here, none of them seem help
i have below method select data mysql database
i have highlighted line error happens on.
the string sql being passed select * tbldtcategory;
opendbconnection(dbconn)) open connection , return problems it, runs fine
i can't understand why i'm getting error, looking @ adapter seems ok, , i'm not trying add or update database can't mismatched type...
public datatable select(string sql) { mysqlconnection dbconn = new mysqlconnection(dbconnection); mysqldataadapter adapter = new mysqldataadapter(); datatable rettable = new datatable(); if (opendbconnection(dbconn)) { try { adapter.selectcommand = new mysqlcommand(sql, dbconn); adapter.fill(rettable); // error here } catch (exception ex) { messagebox.show(ex.message); return null; } { closedbconnection(dbconn); } } else return null; return rettable; } image show must have connected database

image show should returned 
**note record: 3-newcat-1 added app changing select statement insert statement - no problems (!)
stacktrace:
@ system.number.stringtonumber(string str, numberstyles options, numberbuffer& number, numberformatinfo info, boolean parsedecimal) @ system.number.parseint32(string s, numberstyles style, numberformatinfo info) @ system.int32.parse(string s, iformatprovider provider) @ mysql.data.types.mysqlint32.mysql.data.types.imysqlvalue.readvalue(mysqlpacket packet, int64 length, boolean nullval) @ mysql.data.mysqlclient.nativedriver.readcolumnvalue(int32 index, mysqlfield field, imysqlvalue valobject) @ mysql.data.mysqlclient.driver.readcolumnvalue(int32 index, mysqlfield field, imysqlvalue value) @ mysql.data.mysqlclient.resultset.get_item(int32 index) @ mysql.data.mysqlclient.mysqldatareader.getfieldvalue(int32 index, boolean checknull) @ mysql.data.mysqlclient.mysqldatareader.getvalue(int32 i) @ mysql.data.mysqlclient.mysqldatareader.getvalues(object[] values) @ system.data.providerbase.datareadercontainer.commonlanguagesubsetdatareader.getvalues(object[] values) @ system.data.providerbase.schemamapping.loaddatarow() @ system.data.common.dataadapter.fillloaddatarow(schemamapping mapping) @ system.data.common.dataadapter.fillfromreader(dataset dataset, datatable datatable, string srctable, datareadercontainer datareader, int32 startrecord, int32 maxrecords, datacolumn parentchaptercolumn, object parentchaptervalue) @ system.data.common.dataadapter.fill(datatable[] datatables, idatareader datareader, int32 startrecord, int32 maxrecords) @ system.data.common.dbdataadapter.fillinternal(dataset dataset, datatable[] datatables, int32 startrecord, int32 maxrecords, string srctable, idbcommand command, commandbehavior behavior) @ system.data.common.dbdataadapter.fill(datatable[] datatables, int32 startrecord, int32 maxrecords, idbcommand command, commandbehavior behavior) @ system.data.common.dbdataadapter.fill(datatable datatable) @ downtime_aquisition_administrator.mysqlserver.select(string sql) in d:\vs2012\projects\downtime acquisition\downtime aquisition administrator\downtime aquisition administrator\frmmain.cs:line 1996
ok found problem - school boy error lol
went mysql server , ran setup again, chose utf-8 instead of 1 of drop down options text format, works fine
..and feel stupid :)
Comments
Post a Comment