主题:[讨论]与sql2000连接问题,怎么总是登录错误?
[color=000000][color=000000][color=FFFFFF][color=008000][color=800000][size=4]代码如下:[/size][/color][/color][/color][/color][/color]
SqlConnection myConnection = new SqlConnection("server=(local);database=test;Trusted_Connection=yes");
string strSql="Insert into test1 values('"+IDTB.Text+"','"+FirstNameTB.Text+"','"+LastNameTB.Text+"','"+JobIDTB.Text +"','"+PubIDTB.Text+"')";
myConnection.Open();
SqlCommand myCommand = new SqlCommand(strSql, myConnection);
myCommand.ExecuteNonQuery();
lblMessage.Text="添加成功!";
[color=808080][color=800080][color=000080][color=808000][color=800000][size=4]错误如下:[/size][/color][/color][/color][/color][/color]
用户 'FZKX-116\ASPNET' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 用户 'FZKX-116\ASPNET' 登录失败。
源错误:
行 65: SqlConnection myConnection = new SqlConnection("server=(local);database=test;Trusted_Connection=yes");
行 66: string strSql="Insert into test1 values('"+IDTB.Text+"','"+FirstNameTB.Text+"','"+LastNameTB.Text+"','"+JobIDTB.Text +"','"+PubIDTB.Text+"')";
行 67: myConnection.Open();
行 68: SqlCommand myCommand = new SqlCommand(strSql, myConnection);
行 69: myCommand.ExecuteNonQuery();
源文件: c:\inetpub\wwwroot\test14\addemployee.aspx.cs 行: 67
堆栈跟踪:
[SqlException: 用户 'FZKX-116\ASPNET' 登录失败。]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
ADONETExample.AddEmployee.Summit_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\test14\addemployee.aspx.cs:67
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
SqlConnection myConnection = new SqlConnection("server=(local);database=test;Trusted_Connection=yes");
string strSql="Insert into test1 values('"+IDTB.Text+"','"+FirstNameTB.Text+"','"+LastNameTB.Text+"','"+JobIDTB.Text +"','"+PubIDTB.Text+"')";
myConnection.Open();
SqlCommand myCommand = new SqlCommand(strSql, myConnection);
myCommand.ExecuteNonQuery();
lblMessage.Text="添加成功!";
[color=808080][color=800080][color=000080][color=808000][color=800000][size=4]错误如下:[/size][/color][/color][/color][/color][/color]
用户 'FZKX-116\ASPNET' 登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 用户 'FZKX-116\ASPNET' 登录失败。
源错误:
行 65: SqlConnection myConnection = new SqlConnection("server=(local);database=test;Trusted_Connection=yes");
行 66: string strSql="Insert into test1 values('"+IDTB.Text+"','"+FirstNameTB.Text+"','"+LastNameTB.Text+"','"+JobIDTB.Text +"','"+PubIDTB.Text+"')";
行 67: myConnection.Open();
行 68: SqlCommand myCommand = new SqlCommand(strSql, myConnection);
行 69: myCommand.ExecuteNonQuery();
源文件: c:\inetpub\wwwroot\test14\addemployee.aspx.cs 行: 67
堆栈跟踪:
[SqlException: 用户 'FZKX-116\ASPNET' 登录失败。]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
ADONETExample.AddEmployee.Summit_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\test14\addemployee.aspx.cs:67
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()