Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 在cshtml中创建新闻源_Mysql_Asp.net Mvc_Asp.net Mvc 4_Razor - Fatal编程技术网

Mysql 在cshtml中创建新闻源

Mysql 在cshtml中创建新闻源,mysql,asp.net-mvc,asp.net-mvc-4,razor,Mysql,Asp.net Mvc,Asp.net Mvc 4,Razor,我在数据库中有以下内容 status table - status_id, status_body, status_date student table - student_id, student_username, student_firstname, student_lastname follow table - followId, follow_followerid, follow_followingid` 现在,我想显示用户的状态,比如说用户a当前跟踪的用户以及他的用户a自己的状态更新

我在数据库中有以下内容

status table - status_id, status_body, status_date
student table - student_id, student_username, student_firstname, student_lastname
follow table - followId, follow_followerid, follow_followingid`
现在,我想显示用户的状态,比如说用户a当前跟踪的用户以及他的用户a自己的状态更新

如何在cshtml中实现它?SQL查询对此是必需的。
有什么帮助吗?

您不能将sql查询放在cshtml文件中。必须发生一连串的事件。提供cshtml时,只包含数据库查询的结果。您还需要一些服务器端代码来为cshtml服务,例如使用MVC的c。您需要一种访问数据库的方法,例如对象关系映射器,如实体框架。如果你想成功,你有很多步骤