兄弟们帮菜鸟我看下是什么原因:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
private DataSet GetProductData()
{
string SQLStatement = "SELECT * FROM [Sheet1$]";
SqlConnection myConnection = new SqlConnection(@"Data Source=PC-200809091750;Initial Catalog=master;Integrated Security=True");
System.Data.SqlClient.SqlDataAdapter myCommand = new System.Data.SqlClient.SqlDataAdapter(SQLStatement, myConnection);
myCommand.SelectCommand.CommandType=CommandType.Text;
System.Data.DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, "Sheet1$");
return myDataSet;
}
protected void BindGrid()
{
MyDataGrid.DataSource = GetProductData().Tables["Sheet1$"].DefaultView;
MyDataGrid.DataBind();
}
}
在VS2005下调试正常,但在配置好本机网站后,访问该网页,报错
用户 'PC-200809091750\ASPNET' 登录失败。
说明: 执行当前 Web 请求期间,出�%POST https://forum.csdn.net/PointForum/Forum/PostT5��。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 用户 'PC-200809091750\ASPNET' 登录失败。
源错误:
行 34: System.Data.DataSet myDataSet = new DataSet();
行 35:
行 36: myCommand.Fill(myDataSet, "Sheet1$");
行 37:
行 38: return myDataSet;
为什么就不能登录SQLSERVER了,SQLSERVER也在本机上