Home > Net >  Made an example of a web, asp.net core in getdata. CSHTML do not agree with the view in the homecont
Made an example of a web, asp.net core in getdata. CSHTML do not agree with the view in the homecont

Time:12-22

[the Route (" getdata ")]
Public ActionResult GetData ()
{
The DataSet ds=_getdatabasedata. Igetdatabasedata ();

//return the Content (ds) Tables [0]. Rows [0] [0]. The ToString ());
Return the View (ds) Tables [0]).
}
Through the View returns a recordset
The getdata. CSHTML used in
@ model WebApplication1. Models. Getdatabasedata
To quote the following wrong
InvalidOperationException: The model item passed into The ViewDataDictionary is of type 'System. Data. DataTable', but this ViewDataDictionary instance requires a model item of type 'WebApplication1. Models. Getdatabasedata'.
Microsoft. AspNetCore. Mvc. ViewFeatures. ViewDataDictionary. EnsureCompatible (object value)
Mean I passed, do not agree with the inside of the instance,
Getdatabasedata is a class with a method Igetdatabasedata returns is from the database record set

How can the getdata. CSHTML in taking out the data in the record set?
  • Related