protected void txtSaveInvoice_Click(object sender, EventArgs e) { SqlConnection conInvoice3 = new SqlConnection (@"Data Source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|\TRANE.mdf;Integrated Security=True;User Instance=True"); conInvoice3.Open(); string saveInvoice; saveInvoice = "INSERT INTO Invoice(EmpID, UnitList, CustomerID, InvoicePrice, Datetime, Comment) Values ('" + UserLabel.Text + "', '" + Label2.Text + "', '" + txtCust.Text + "', '" + Label4.Text + "', '" + LabelDate.Text + "', '" + txtRemark.Text + "') SET @InvID = SCOPE_IDENTITY()"; SqlCommand cmdInvoice = new SqlCommand(saveInvoice, conInvoice3); cmdInvoice.ExecuteNonQuery(); Response.Redirect("invoice_redirect.aspx"); conInvoice3.Close(); }