Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
cmd.CommandType = CommandType.Text;
                 cmd.Connection = sqlcon;
                 cmd.CommandText = "INSERT INTO TBL_Customers (customer_name,FK_fk_id,commissary,FK_area_id,customer_address,tel1,tel2
,id_number,datebirth,tel4) VALUES (@customer_name,@FK_fk_id,@commissary,@FK_area_id,@customer_address,@tel1,@tel2,@id_number,@datebirth,@tel4)";
                 cmd.Parameters.AddWithValue("@customer_name", txtname.Text);
                 cmd.Parameters.AddWithValue("@FK_fk_id", comboCategoryCustomers.ValueMember);
                 cmd.Parameters.AddWithValue("@commissary", txtcommissary.Text);
                 cmd.Parameters.AddWithValue("@FK_area_id", comboAreaCustomer.ValueMember);
                 cmd.Parameters.AddWithValue("@customer_address", txtcustomer_address.Text);
                 cmd.Parameters.AddWithValue("@tel1", txttel1.Text);
                 cmd.Parameters.AddWithValue("@tel2", txttel2.Text);
                 cmd.Parameters.AddWithValue("@id_number", txtid_number.Text);
                 cmd.Parameters.AddWithValue("@datebirth", this.dateTimePicker1datebirth);
                 cmd.Parameters.AddWithValue("@tel4", txttel4.Text);




                 sqlcon.Open();
                 cmd.ExecuteNonQuery();

                 MessageBox.Show("Saved");
                 sqlcon.Close();
Posted
Updated 17-Dec-14 17:15pm
v2
Comments
Garth J Lancaster 17-Dec-14 23:15pm    
why have you reposted this, instead of continuing with your original question at http://www.codeproject.com/Questions/854132/My-Code-Dose-not-Work?arn=0
Suvendu Shekhar Giri 1-Jan-15 7:00am    
What is the error, you are getting?
Subramanyam Shankar 6-Mar-15 10:12am    
Hi,

Can you provide more details please? what was the error you getting or if there was any error or exception? which columns were not null and whether values are coming properly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900