Potato Penguin
SQL overwrites instead off adds
public bool AddNewCustomer(CustomerClass customer)
{
SqlCommand command = new SqlCommand();
command.CommandText = string.Format("INSERT INTO tblCustomer VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", customer.CTitle, customer.CForename, customer.CSurname, customer.CEmail, customer.CContactNum1, customer.CContactNum2);
return ExecuteNonQuery(command);
}
so when i run this it adds a new customer just fine, i close the programme open it again add new customer it does it but replaces the previously made customer, i have a near identical prodject and run this same sql and it works perfectly anyone know if its a visual studio problem or is their a fix?
30 replies