如何将Razor Pages ASP.NET应用程序连接到已经存在的已存在的MSSQL数据库?
我想创建一个Razor Pages应用程序,在其中我将显示数据库中的条目。我应该在连接字符串中放置什么?我可以登录到此数据库和服务器。
在连接到它之后,如何访问它并简单地显示页面中DB的所有行?
I want to create a Razor Pages app where I would display the entries from a database. What am I supposed to put in the Connection String? I have the login to this database and the server.
And after I connect to it, how do I access it and simply display all the rows from the db in a page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该考虑一些事情,以便在剃须刀页面中访问DB的实体。
在AppSettings.json Local:
remote:
,您可以通过上下文中使用依赖项注入和访问实体:
There are a few things you should consider in order to access entities from DB in Razor Pages.
local:
remote:
Than you can use Dependency Injection and access entity in your page via context: