-1

CS Code

int hrd1 = bl.BL_INSERT_HR_UPLOAD(FORM_ID, OFFER_ID, DOJ, NI_NUMBER, EMP_ID);

Business Layer

public int BL_INSERT_HR_UPLOAD(string FORM_ID,string OFFER_ID,string DOJ,string NI_NUMBER,string    EMP_ID)
{
   int hrd1 =dl.DL_INSERT_HR_UPLOAD
   (FORM_ID,OFFER_ID,DOJ,NI_NUMBER,EMP_ID);
   return hrd1;
}

Data Layer

public int DL_INSERT_HR_UPLOAD(string FORM_ID, string OFFER_ID, string DOJ, string NI_NUMBER, string EMP_ID)
{
        con.Close();
        con.Open();
        SqlCommand cmd = new SqlCommand("INSERT_HR_DOCUMENT_UPLOAD", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@FORM_ID", FORM_ID);
        cmd.Parameters.AddWithValue("@OFFER_ID", OFFER_ID);
        cmd.Parameters.AddWithValue("@ABSOLUTE_DOJ", DOJ);
        cmd.Parameters.AddWithValue("@NI_NUMBER",NI_NUMBER);
        cmd.Parameters.AddWithValue("@EMPLOYEE_NUMBER", EMP_ID);

        return cmd.ExecuteNonQuery();
}

Could you please let me know to write update DB query, so it looks and works the same way the insert code mentioned above. FYI - form_id,offer_id is FK,PK.

2
  • 1
    What have you tried so far? Only copying existing code does not show any effort... Commented Oct 22, 2013 at 10:28
  • The problem is that the stored procedure could touch any number of tables. There are lots of examples of how to do sql updates with parameters. But your problem is larger. You must deconstruct the stored proc. Commented Oct 22, 2013 at 10:34

1 Answer 1

0

like this?

UPDATE HR_TBALE set OFFER_ID=@OFFER_ID,DOJ=@ABSOLUTE_DOJ,NI_NUMBER=@NI_NUMBER,EMP_ID=@EMPLOYEE_NUMBER
WHERE FORM_ID=@FORM_ID
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.