TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ANKIT SHUKLA
NA
173
8k
There is already an open DataReader associated with this cmd
Jun 6 2018 12:34 PM
Given this Error On Post Method.
[HttpPost]
public ActionResult Index(LoginModel model)
{
int id = model.UniqueId;
string Connect = model.Link;
DataTable dtbl = new DataTable();
using (SqlConnection con = new SqlConnection(connectionString2))
{
con.Open();
string qry = "select * from AppMasterTable where SchoolCode='" + id + "' ";
SqlCommand cmd = new SqlCommand(qry, con);
SqlDataReader sdr = cmd.ExecuteReader();
SqlDataAdapter sqlda = new SqlDataAdapter(qry, con);
if (sdr.Read())
{
sqlda.Fill(dtbl);
if (dtbl.Rows.Count == 1)
{
model.Link = dtbl.Rows[0][2].ToString();
}
return RedirectToAction("Index", "StudentProfile", new { ids = model.Link });
}
else
{
ViewBag.id = model.UniqueId;
ViewBag.Message = "Login Error..!!";
}
con.Close();
}
return View();
}
Reply
Answers (
2
)
Areas-Controller-Action Listing for URL Authorize
how to use Entity frame work in asp.net