C# MySQL Query error handler -
i'm new in visual studio world , need little help.
i'm writing program c# based , executes query when button pressed:
private void button_login_click(object sender, eventargs e) { mysqldataadapter start_session; start_session = new mysqldataadapter("here update query", connection); }
(the connection string on top of code).
is there way check if query returned errors or not ?
thank , sorry (i presume) trivial question.
the way check if error or not "exception". example (for sqlserver, mysql same) :
private void buttonloginclick(object sender, eventargs e) { try { using (var sqliteconnection = new sqliteconnection(connstring)) { sqliteconnection.open(); using (var sqlitecommand = new sqlitecommand(sql, sqliteconnection)) { sqlitecommand.executenonquery(); } } messagebox.show("success"); } catch (exception ex) { messagebox.show("error : " + ex.message); } }
Comments
Post a Comment