I want to assign a value parameter dynamic through an array.
For example, the array arr_param will contain two value [0] = "abc", [1] = "ZYX"
.Now, I will assign them .The problem here is that i must specify the correct elements [0],[1] after run foreach, I tried do it but failed convert to int
string[] arr_param = array_parameter.Split(';');
foreach (DataRow parmRow in parmsDataTable.Rows)
{
string parmName = parmRow[parmNameDataColumn].ToString();
cmd.Parameters.AddWithValue(parmName, arr_param[Convert.ToInt32(parmsDataTable.Rows)]);
}
I get error Unable to cast object of type 'System.Data.DataRowCollection' to type 'System.IConvertible'.