c# - I can only add a record to my database for one time why? -


i'm trying add record database c# project.

i can add record 1 time. next time i'm trying add new record got exception.

why happen? didn't change code. here code:

try {     connect.open();     cmd.connection = connect;      using (cmd = connect.createcommand())     {         cmd.commandtext = @"insert [kalorivediyet].[dbo].[uyeler](kullaniciadi,sifre,mailadresi,cinsiyet,boy,kilo,yaş,kalori) values('" + txtkullanıcıadı.text.trim() + "','" + txtsifre.text.trim() + "','" + txtmail.text.trim() + "','" + selectedcmbox.tostring() + "'," + int.parse(txtboy.text) + "," + float.parse(txtkilo.text) + "," + int.parse(txtyas.text) + "," + kalorii + ")";         cmd.executenonquery();     } } catch(exception) {     messagebox.show("baglanti kurulamadı lütfen tekrar deneyin");     connect.close(); } {     connect.close(); } 

have check if violating of constraints in database scheme? mean, unique values, primary_keys , on... think reason.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -