Click here to Skip to main content
15,916,188 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Cs Code:
C#
int hrd1 = bl.BL_INSERT_HR_UPLOAD(FORM_ID, OFFER_ID, DOJ, NI_NUMBER, EMP_ID);

Business Layer
C#
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
C#
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.
Posted
Updated 21-Oct-13 22:57pm
v2

I recommend that you focus on what's happening in the data layer. When you understand the value being assigned to the SqlCommand.CommandType parameter, and the string being passed to the SqlCommand constructor, I think you'll discover the answer for yourself.
 
Share this answer
 
You need to complete the SQL Statement in your datalayer so that it knows about the data that the table is expecting

http://stackoverflow.com/questions/12879835/sqlparameter-object-c-sharp[^]

read the answer by jon skeet.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900