c# - Trying to edit a text field in MS Access, but it says it needs more parameters -
i'm trying edit textfield in ms access database. i'm able edit number, if try edit textfield asks me more parameters. code looks this:
try { ad.updatecommand = new oledbcommand("update tabel1 set navn=" + txt_navn.text.tostring() + " id=" + txt_userid.text + "", conn); ad.updatecommand = new oledbcommand("update tabel1 set niveau=" + txt_niveau.text.tostring() + " id=" + txt_userid.text + "", conn); conn.open(); ad.updatecommand.executenonquery(); conn.close(); } catch(exception ex) { messagebox.show(ex.message); conn.close(); }
basically, navn text field won't accept changes , asks more parameters if disable niveau line. i've tried having both within same ad.updatecommand
line, gave me error.
as doesn't give error, doesn't change 'navn' field in database, 'niveau' field changes fine. guys have idea?
navn
may reserved, try frame it. also, there should no reason cast text content of textbox string. and, mentioned, 1 call it:
ad.updatecommand = new oledbcommand("update tabel1 set [navn] = '" + txt_navn.text + "', niveau = " + txt_niveau.text + " id = " + txt_userid.text + "", conn);
Comments
Post a Comment