5
Reply

Why my insertion is not working ?

Tangara G

Tangara G

Feb 9 2017 11:02 AM
182
Hi expert,
 
Can someone advise me if there is anything wrong with the below code cos my insertion is not working.
 
  1. internal void UpdateRequest(string action, string RefNo, string name, int status)  
  2.         {  
  3.             con.Open();              
  4.             SqlCommand cmd = new SqlCommand(UpdateRequest", con);              
  5.             cmd.Parameters.AddWithValue("@action", action);  
  6.             cmd.Parameters.AddWithValue("@PMTNo", RefNo);  
  7.             cmd.Parameters.AddWithValue("@name", Name);  
  8.             cmd.Parameters.AddWithValue("@status", status);  
  9.             cmd.CommandType = CommandType.StoredProcedure;  
  10.             cmd.ExecuteNonQuery();  
  11.             con.Close();  
  12.         } 
 My stored Procedure :
  1. if @action='Save' or @action='Submit'  
  2. begin  
  3. Insert into REQUEST  
  4. ([RefNo, Name, status  
  5.     Values  (  
  6.       @PMTNo, @name, @status)) 
  1. internal void UpdateRequest(string action, string RefNo, string IssuerName  
  2.         int status)  
  3.  {  
  4.                   
  5. DAO.UpdateRequest(action, RefNo, status); 
 
  1. protected void btnSave_Click(object sender, EventArgs e)  
  2.         {  
  3.             if (Request.QueryString["RefID"] != null)  
  4.             {  
  5.                                  
  6.                 string Action = "Save";  
  7.   
  8.                 string RefNo = Request.QueryString["RefID"].ToString();  
  9.         UpdateRequest(action, RefNo, status);  
  10.                 Response.Redirect("abc.aspx");   

 
 

Answers (5)