C# (0x80131904):登录失败
我正在设置一个简单的服务器,并且有一些连接问题 我知道还有其他人在这上面贴了帖子,但我还是搞不清楚C# (0x80131904):登录失败,c#,sql,azure,azure-sql-database,C#,Sql,Azure,Azure Sql Database,我正在设置一个简单的服务器,并且有一些连接问题 我知道还有其他人在这上面贴了帖子,但我还是搞不清楚 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; namespace DormWeb { pub
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace DormWeb
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
insertName.Text = ("Great job. You have figured out what your name is.");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection dormconn = new SqlConnection
("Server=tcp:dormwebserver.database.windows.net,1433;Initial Catalog=DormSQL;Persist" +
" Security Info=True;User ID=Josh@...................onmicrosoft.com;Password=...........;MultipleActiveRe" +
"sultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
{
SqlCommand insert = new SqlCommand("EXEC dbo.InsertFullname @Fullname", dormconn);
insert.Parameters.AddWithValue("@Fullname", insertName.Text);
dormconn.Open();
insert.ExecuteNonQuery();
dormconn.Close();
if (IsPostBack)
{
insertName.Text = "";
}
}
}
}
}
按照说明,已尝试使用服务器的管理员帐户和辅助管理员帐户登录VS
我正在通过active directory登录SQL management studio。也许这就是我的问题?当我选择active directory连接字符串时,无法使其工作
删除用户名和密码周围的{和} 在从Azure portal获得的连接字符串中:
Server=tcp:jacksqldemo.database.windows.net,1433;Initial Catalog=sqldemo;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
{your_username}和{your_password}只是占位符 为什么那些{和}在字符串中?他们不应该在那里。删除这些,它就会工作。@mjwills+$exception{无法打开登录请求的服务器\jbu*******outlookcom.onmicrosoft.com\登录失败。}System.Data.SqlClient.sqlexception您的用户名或密码错误。您是否尝试过在使用SQL Server身份验证而不是Windows身份验证通过SSMS连接时使用该用户名和密码?@mjwills So-我只是尝试了SQL Server身份验证登录,它只是一个用户名,后面没有outlookcom.onmicrosoft.com。仍然登录失败:有任何提示或提示吗?在使用SQL Server身份验证而不是Windows身份验证通过SSM连接时,您是否尝试过使用该用户名和密码?