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。您需要一种访问数据库的方法,例如对象关系映射器,如实体框架。如果你想成功,你有很多步骤