c# - No data insertion (message: insertion successful) -
private void isave_itemclick(object sender, devexpress.xtrabars.itemclickeventargs e) { using (sqlconnection conn = new sqlconnection(connection.con)) { conn.open(); using (sqlcommand cmd = new sqlcommand(@"insert [city] (name) values (@name)", conn)) { cmd.parameters.addwithvalue("@name", city.text.tolower()); messagebox.show(city.text); messagebox.show("insertion successful"); } using (sqlcommand cmd = new sqlcommand(@"insert [state] (name) values (@name)", conn)) { cmd.parameters.addwithvalue("@name", state.text.tolower()); messagebox.show("insertion successful"); } conn.close(); } }
program not inserting, rows in database tables empty , i'm getting messages insertion successful. please help. thanks.
you fail execute query - take at
i.e. you're missing
cmd.executenonquery();
call.
... cmd.parameters.addwithvalue("@name", city.text.tolower()); cmd.executenonquery(); ...
Comments
Post a Comment