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
rosemary
NA
57
20.9k
Error in return view
Jun 12 2018 11:14 PM
Error:Cannot implicitly convert type 'System.Web.Mvc.ViewResult' to 'System.Data.DataSet'
samplecontroller.cs
public DataSet displaydetails(student s)
{
dbconnection db = new dbconnection();
DataSet ds = db.display(s);
s.show = ds;
return View(s); //error shows here
dbconnection.cs
public DataSet display(student s)
{
SqlCommand cmd = new SqlCommand("select * from register", con);
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
}
displaydetails.cshtml
@model MVC_Homework.Models.student
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>displaydetails</title>
</head>
<body>
<div>
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>Place</th>
<th>Edit</th>
<th>Delete</th>
</tr>
@{
for(int i=0;i<Model.show.Tables[0].Rows.Count;i++)
{
var name = Model.show.Tables[0].Rows[i]["name"].ToString();
var age = Model.show.Tables[0].Rows[i]["age"].ToString();
var place = Model.show.Tables[0].Rows[i]["place"].ToString();
<tr>
<td>@name</td>
<td>@age</td>
<td>@place</td>
<td>@Html.ActionLink("Edit","edit")</td>
<td>@Html.ActionLink("Delete","delete")</td>
</tr>
}
}
</table>
</div>
</body>
</html>
Anybody help to solve this..
thks in adv!!
Reply
Answers (
1
)
0
rajendra singh
688
1.4k
10k
Jun 12 2018 11:55 PM
Could you please tell what error you exactly getting on return View(s).
Export To Word - Panel and placeholder - IMP
Could not load type 'TTT.SSC.UI.Content.Global'