c# - OleDB update command not changing data -
i'm using microsoft access file database. have no problem select
, insert
queries when try update
, record in database not change.
below code use run update. there no exceptions or errors in debug log.
cnn = new oledbconnection(connetionstring); oledbcommand command = new oledbcommand("update [wpisy] set [wpis]=@wpis, [id_kat]=@id_kat, [tytul]=@tytul [id]=@id_wpis" , cnn); command.parameters.add(new oledbparameter("@wpis", tresc_wpisu.text)); command.parameters.add(new oledbparameter("@id_kat", lista_kategorii.selectedvalue)); command.parameters.add(new oledbparameter("@tytul", tytul_wpisu.text)); command.parameters.add(new oledbparameter("@id_wpis", request["id"].tostring() )); command.connection = cnn; try { if(cnn.state.tostring() != "open") cnn.open(); command.executenonquery(); cnn.close(); } catch (oledbexception ex) { response.clear(); response.write(ex); response.end(); }
i go microsoft access , enter command there , see happens. should tell how many rows affected. if says 0 rows, break query smaller pieces, such as:
select * [id]=value
and should able track down problem is.
Comments
Post a Comment