I want to insert two variables foreach loop wise into database.how to do it?
foreach (string item in split)
{
val = item;
foreach (string uid in useid)
{
useval = uid;
}
command = new SqlCommand();
command.CommandText = "Insert_SentSMS";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@sentTime", sentTime);
command.Parameters.AddWithValue("@mobileNo", val);
command.Parameters.AddWithValue("@userid", useval);
command.Parameters.AddWithValue("@smsType", "Manual");
command.Parameters.AddWithValue("@smsText", smsText);
command.Parameters.AddWithValue("@registrationId", lblCustomSMSRegId.Text);
command.Connection = connection;
command.ExecuteNonQuery();
}
}
i tried like above but 'useval ' value getting same not other values..

Saroj Kumar SahuPosted Jun 11, 2015, 7:43 AM
Dawood AbbasPosted Jun 11, 2015, 7:33 AM
Dawood AbbasPosted Jun 11, 2015, 7:32 AM
Khan Abrar AhmedPosted Jun 11, 2015, 6:21 AM
Saroj Kumar SahuPosted Jun 11, 2015, 6:18 AM