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 SahuRank #1,766 · 849 reputationPosted Jun 11, 2015, 2:18 AM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 11, 2015, 2:21 AM EDT
Dawood AbbasRank #6,413 · 267 reputationPosted Jun 11, 2015, 3:32 AM EDT
Dawood AbbasRank #6,413 · 267 reputationPosted Jun 11, 2015, 3:33 AM EDT
Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 11, 2015, 3:43 AM EDT