Monday 15 September 2014

c# - Data wont delete from table -



c# - Data wont delete from table -

i cannot programme clear sql database on opening. have went through debugging , there no errors in code deleting, doesn't it

string delete = "delete trivia"; con.open(); sqlcommand comm = new sqlcommand(delete, con); con.close();

you're not executing command. might consider using statement. automatically dispose of connection properly, if error occurs:

using (sqlconnection con = new sqlconnection(connectionstring)) { con.open(); sqlcommand comm = new sqlcommand("delete trivia", con); comm.executenonquery(); }

c# sql

No comments:

Post a Comment