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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -