简体   繁体   English

ASP.net连接到数据库

[英]ASP.net Connect to database

Hi guys I'm trying to connect to a MSSQL database with ASP.net! 嗨,大家好,我正在尝试使用ASP.net连接到MSSQL数据库! I've created a Database containing 3 tables, but every time I try and connect to the database I receive an error message stating I must obtain permission first... How do I connect or get the permission? 我创建了一个包含3个表的数据库,但是每次尝试连接数据库时,都会收到一条错误消息,指出必须首先获得权限...如何连接或获取权限?

Windows Authentication Windows验证

error 错误

you do not have permission to open this file 您无权打开此文件

contact the file owner or an administrator to obtain permission 与文件所有者或管理员联系以获取许可

You can adjust your string connection with IntegratedSecurity = true 您可以使用IntegratedSecurity = true调整字符串连接

Link : http://msdn.microsoft.com/fr-fr/library/system.data.sqlclient.sqlconnectionstringbuilder.integratedsecurity.aspx 链接: http : //msdn.microsoft.com/fr-fr/library/system.data.sqlclient.sqlconnectionstringbuilder.integratedsecurity.aspx

Nota : information current Windows account credentials are used for authentication 注意:当前Windows帐户凭据的信息用于身份验证

Nota : you can also use server account (false), but you must specify in your string connection 注意:您也可以使用服务器帐户(false),但必须在字符串连接中指定

Another link about build string connection : http://www.connectionstrings.com/sql-server-2012 有关构建字符串连接的另一个链接: http : //www.connectionstrings.com/sql-server-2012

Try something different such as enabling "SQL Server and Windows Authentication mode" in SQL Management Studio 尝试不同的操作,例如在SQL Management Studio中启用“ SQL Server和Windows身份验证模式”
Right click the Server node => Properties => Security 右键单击服务器节点=>属性=>安全

Then create a new SQL user profile with full permissions to your database and use those credentials in you connection string. 然后创建一个对数据库具有完全权限的新SQL用户配置文件,并在连接字符串中使用这些凭据。

您的应用程序池标识必须具有足够的权限才能访问您的数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM