title: Is it possible to reuse the code to update/insert record in multple tables from multiple WinFoms
body: <p>I have this code to insert record into Table Products.  </p>
  
  <pre><code>int insertRecordIntoProduct()
  {
     try
      {
          if (con.State == ConnectionState.Closed)
          {
              con.Open();
          }
         string insQuery = "insert into product_details (prod_name,prod_desc,prod_status,start_date,end_date,ref_num,ror) "+  
                           "values(@p_name,@p_desc,@status,@sdate,@edate,@filenum,@ror)";
  
      SqlCommand insertCmd = new SqlCommand(insQuery, con);
  
      insertCmd.Parameters.Clear();
      insertCmd.Parameters.AddWithValue("@p_name", txtProdName.Text);
      insertCmd.Parameters.AddWithValue("@p_desc", txtProdDesc.Text);
  
      insertCmd.Parameters.AddWithValue("@sdate", (StartDatePicker.Value.Date)); 
      insertCmd.Parameters.AddWithValue("@edate", (EndDatePicker.Value.Date)); 
      insertCmd.Parameters.AddWithValue("@filenum", txtBoxFileNum.Text);
  
     int r= insertCmd.ExecuteNonQuery();  
      return r;
     }
  }
  </code></pre>
  
  <p>This code is working fine. My Problem is that I have 10-12 wiforms and each form need to insert/update record in different Tables into same database. Now I want to know that can I use the above code in any way to insert/update record from various forms that have different no. of TextBoxes (for ex. - my CustomerDetail form have 15 TextBoxes, Brokerage form have 8 TexBoxes etc.) or I have to do to the same for each form(whichh take a lot time).
  Also tell me if there is any other alternative to do this in best manner.</p>