用户sa登录失败

ab83328523 2008-11-14 09:28:56
后台管理的文件运行时没有问题 ,运行首页就报这个错 首页的代码如下



using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.DataToBind();
this.DataToBind7();
this.DataToBind4();
this.DataToBind5();
this.DataToBind6();
this.DataToBind2();
this.DataToBind3();
this.DataToBind8();
this.DataToBind9();
this.DataToBind1();
}
private void DataToBind()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from xinwen where fenlei='温商动态' order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 7, "new");
this.DataList1.DataKeyField = "id";
this.DataList1.DataSource = ds;
this.DataList1.DataBind();
MyConn.Close();
}
private void DataToBind1()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from xinwen where fenlei='新闻热点' order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 6, "new");
this.DataList2.DataKeyField = "id";
this.DataList2.DataSource = ds;
this.DataList2.DataBind();
MyConn.Close();
}
private void DataToBind2()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from gqtd order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 6, "new");
this.DataList3.DataKeyField = "id";
this.DataList3.DataSource = ds;
this.DataList3.DataBind();
MyConn.Close();
}
private void DataToBind3()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from new where fenlei='招商引资' order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 6, "new");
this.DataList4.DataKeyField = "id";
this.DataList4.DataSource = ds;
this.DataList4.DataBind();
MyConn.Close();
}
private void DataToBind4()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from new where fenlei='政策法规' order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 6, "new");
this.DataList5.DataKeyField = "id";
this.DataList5.DataSource = ds;
this.DataList5.DataBind();
MyConn.Close();
}
private void DataToBind5()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from new where fenlei='企业文化' order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 6, "new");
this.DataList6.DataKeyField = "id";
this.DataList6.DataSource = ds;
this.DataList6.DataBind();
MyConn.Close();
}
private void DataToBind6()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from new where fenlei='河套乡友' order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 6, "new");
this.DataList7.DataKeyField = "id";
this.DataList7.DataSource = ds;
this.DataList7.DataBind();
MyConn.Close();
}
private void DataToBind7()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from qiyehy order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 12, "new");
this.DataList8.DataKeyField = "id";
this.DataList8.DataSource = ds;
this.DataList8.DataBind();
MyConn.Close();
}
private void DataToBind8()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from link1 order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 1, "new");
this.DataList9.DataKeyField = "id";
this.DataList9.DataSource = ds;
this.DataList9.DataBind();
MyConn.Close();
}
private void DataToBind9()
{
SqlConnection MyConn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);
MyConn.Open();
SqlCommand cmd = new SqlCommand("select * from link1 order by id Desc", MyConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, 0, 1, "new");
this.DataList11.DataKeyField = "id";
this.DataList11.DataSource = ds;
this.DataList11.DataBind();
MyConn.Close();
}
}
...全文
1422 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zxzy668 2008-11-14
  • 打赏
  • 举报
回复
既然sa登录不了,就是数据库根本没有连接上啊。
connectionString="Data Source=机器名或IP地址\sqlexpress;Initial Catalog=数据库名;User ID=sa;Password=sa"
这是SQLServer 2005 EXPERSS版的数据库连接方法,LZ看看是不是这里出了问题,或者是数据库服务没开。
iwalk 2008-11-14
  • 打赏
  • 举报
回复
sqlserver设置有问题
melon23 2008-11-14
  • 打赏
  • 举报
回复
用sqldatasource控件自动创建连接后,看看它的连接字符串,再贴到你的DBConnectionString上
melon23 2008-11-14
  • 打赏
  • 举报
回复
估计是 DBConnectionString 有错,贴出来看看。还有数据库是express的吗?
三碗猪脚 2008-11-14
  • 打赏
  • 举报
回复
用查询分析器登录试试

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧