I am working on C# window form application, which do insert, update of data into the database.
I am having trouble, since I am new into this. I have declared temp variable that gets value if record exsits in the database. But in some scenarios if record is loaded onto the form temp variable will be 1, but if selection was changed from original to amendment the temp variable need to add 1 to the previous value and then save into the datbase with value for that field as 2. So I will have both records original and amended. If user add another amendment to same record datareader will read value as 2 and save as 3 on accept button click.
private void btnaccept_Click(object sender, System.EventArgs e)
{
if (cmbcert.Text == "ORIGINAL")
{
cmd.Parameters.Add("@DOC_SEQ_NUM", SqlDbType.Char, 1).Value = 1;
}
if (cmbcert.Text == "AMENDMENT")
{
cmd.Parameters.Add("@DOC_SEQ_NUM", SqlDbType.Char, 1).Value = tempdoc.Trim();
}
}