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;
}
| Name | Age | Place | Edit | Delete |
|---|---|---|---|---|
| @name | @age | @place | @Html.ActionLink("Edit","edit") | @Html.ActionLink("Delete","delete") |
thks in adv!!
rajendra singhPosted Jun 12, 2018, 11:55 PM