How to insert multiple rows from form in to database.
Hello Everyone,
I am trying to insert multiple rows in to database but not sure how to proceed.
In the form I am selecting company name and then I need to enter employee records one by one. How to enter the multiple records at a time? Below is my piece of code which works fine for single record when submitting:
OracleCommand cmd1 = new OracleCommand("Insert_Employee_Det", con);
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.Add(new OracleParameter("fname", txtfname1.Text));
cmd1.Parameters.Add(new OracleParameter("lname", txtlname1.Text));
cmd1.Parameters.Add(new OracleParameter("address", txtaddr.Text));
try
{
con.Open();
cmd1.ExecuteNonQuery();
}
catch (Exception err)
{
}
finally
{
con.Close();
}
Regards.