c# - mysql foreign key mistake -


i need issue. there problem not find it

error message is

cannot add or update child row: foreign key constraint fails (db_kiosk.tbl_oyunhareketi, constraint oh_kioskid foreign key (oh_kioskid) references tbl_kiosk (kiosk_id) on delete no action on update no action)

here code c#

string sql = "insert db_kiosk.tbl_oyunhareketi (oh_oyuncuid,oh_kioskid,oh_puan,oh_tarih,oh_controlrow) values ('"+convert.toint32(label4.text)+"','"+convert.toint32(label3.text)+"','" + puan_txt.text + "' , '" + tarih_txt.text + "',1)";  label3.text = kiosk_drop.selectedvalue;  label4.text = oyuncu_drop.selectedvalue; 

kiosk_drop , oyuncu_drop dropdownlist in asp.net , in selectedindexchanged function. when display labels values coming problem insertion. db attributes integer couldn't find problem.

you have foreign key constraint prevents adding rows child table before have relevant information in parent table.

in case should first populate tbl_kiosk before adding row tbl_oyunhareketi. rows matched columns oh_kioskid , kiosk_id.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -