首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

连SQL数据库报错

2012-10-13 
连SQL数据库报错,求助同学那边拷贝过来一个源码程序,在VS2010里调试运行,提示SA登录失败提示如下:用户代码

连SQL数据库报错,求助
同学那边拷贝过来一个源码程序,在VS2010里调试运行,提示SA登录失败
提示如下:
用户代码未处理 System.Data.SqlClient.SqlException
  Message=用户 'sa' 登录失败。
  Source=.Net SqlClient Data Provider
  ErrorCode=-2146232060
  Class=14
  LineNumber=65536
  Number=18456
  Procedure=""
  Server=.\sqlexpress
  State=1
  StackTrace:
  在 WebYYCL_CRM.BLL.ServiceUser.UserLogin(String strUserName, String strPass) 位置 d:\网站资料11\2012网站资料\WebYYCLCRM\BLL\ServiceUser.cs:行号 353
  在 WebYYCL_CRM.Index.BtnLogin_Click(Object sender, EventArgs e) 位置 d:\网站资料11\2012网站资料\WebYYCLCRM\Index.aspx.cs:行号 30
  在 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
  在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
  在 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(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 


[解决办法]
你数据库支持sa用户吗,高版本的默认不开放sa,需要另行设置
或者人家加了密码,你没加等等
[解决办法]
检查连接字符串。

“同学那边拷贝过来一个源码程序”,数据库也要store你的机器上,并设置用户名和密码。
[解决办法]
数据库考到你本地来,附加进去,重新设置登录名和密码;或者你们两在一个局域网下,修改下数据库连接字符串,将server处,换成你同学的ip;

热点排行