How to store values ​​in a DB from multiple text fields

I have 14 text boxes in an application where the user enters numbers with a digit. My task is to get and store the values ​​of all 14 text fields in the DB ... I am facing the problem of passing a string for all text fields. Can anyone help me write the code in the .aspx file ? I did a bit of work on this: I need help writing a method where we can pass all 14 values ​​as a single string.

BLL: public static SubmitParentReport GetItem(string needHours) { 
  return SubmitParentReportDB.GetItem(needHours); 
}

BO: private string needHours = ""; public string NeedHours { 
  get { return needHours; } 
  set { needHours = value; } 
}

DAL: This parameter I am using to store in database:

OracleParameter prm3 = new OracleParameter("i_need_hours", OracleType.VarChar, 2);    
prm3.Direction = ParameterDirection.Input; prm3.Value = needHours;    
myCommand.Parameters.Add(prm3);

      

0


source to share


1 answer


You can pass a delimited string to a stored procedure that will parse the string.



However, I would rather create a separate OracleParameter for each of the 14 values ​​that you want to store. This way, you have better control over the integrity of the data type, and each layer of the application knows exactly what arguments to expect and what to do with them.

+1


source







All Articles