i have a field named customerName in database and might many time this field was Initialized i want save my Previous values and append new value at end of field as string, my proc:

CREATE PROC sp_GpInsert
@CName nvarchar(450),
@CEmail VARCHAR(250),
@GName NVARCHAR(70)
AS
BEGIN
Update TBLGroupCustomers
SET 
CustomersName=@CName,
CustomerEmail=@CEmail
WHERE GName=@Gname
END

my code

SqlCommand cmd1 = new SqlCommand("sp_GpInsert", conn);
                cmd1.CommandType = CommandType.StoredProcedure;

                cmd1.Parameters.Add(new SqlParameter("@CName", txtCName.Value));
                cmd1.Parameters.Add(new SqlParameter("@CEmail", txtemail.Value));
                cmd1.Parameters.Add(new SqlParameter("@GName", YrStr));


                cmd1.ExecuteNonQuery();

this code cannot save Previous value

Related posts

Recent Viewed