Parameterized MySql Query in vb.net Not Passing to DB -
cant seem pass data base assume there issue query appreciated.there no errors given vs , leads me think issue statement, sadly cannot test in navicat because not "true values" tried using parameters
params.add(new mysqlparameter("@eventdate", eventdate))
and paramiters this
params.add(new mysqlparameter("eventdate", eventdate))
same results both
public function parameterizednonquerycommand(byref nonquery string, byval parameters list(of mysqlparameter), _ optional byval connection mysql.data.mysqlclient.mysqlconnection = nothing) integer dim comm new mysql.data.mysqlclient.mysqlcommand(nonquery, connection) try each param mysql.data.mysqlclient.mysqlparameter in parameters comm.parameters.add(param) next if comm.connection.state <> connectionstate.open comm.connection.open() comm.prepare() return comm.executenonquery() catch ex exception return ctype(false, integer) messagebox.show(ex.message) comm.connection.close() comm.dispose() end try end function dim query string = "insert so_events (date, user, ip, method, event, staffed, details, backgroundcolor, textcolor, recurring, font, textsize, tooltip)" _ & "values (@eventdate, @user, @ip, @controlpanel, @eventname, @staffed, @cpevents, @backcolor, @textcolor, @recurring, @fontstyle, @fontsize, @allowtool)" dim params new list(of mysqlparameter) params.add(new mysqlparameter("@eventdate", eventdate)) params.add(new mysqlparameter("@user", frmmain.user)) params.add(new mysqlparameter("@controlpanel", "controlpanel")) params.add(new mysqlparameter("@eventname", eventname)) params.add(new mysqlparameter("@staffed", staffed)) params.add(new mysqlparameter("@cpevents", cpevents)) params.add(new mysqlparameter("@backcolor", backcolor)) params.add(new mysqlparameter("@textcolor", textcolor)) params.add(new mysqlparameter("@recurring", recurring)) params.add(new mysqlparameter("@fontstyle", fontstyle)) params.add(new mysqlparameter("@fontsize", fontsize)) params.add(new mysqlparameter("@allowtool", allowtool)) dim oconnection mysqlconnection = new mysqlconnection("data source=********;database=*******;user id=********;password=*********;") frmpanel.parameterizednonquerycommand(query, params, oconnection)
Comments
Post a Comment