gpt4 book ai didi

mysql - 在 cshtml 中创建新闻源

转载 作者:行者123 更新时间:2023-11-30 00:05:27 25 4
gpt4 key购买 nike

我的数据库中有以下内容

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#。您需要一种访问数据库的方法,例如 Entity Framework 等对象关系映射器。如果您想让这项工作成功,您需要采取很多步骤。

关于mysql - 在 cshtml 中创建新闻源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24599299/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com