小弟正在做网站,出现System.Data.SqlClient.SqlException: 用户 'sa' 登录失败错误。程序如下
usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingS...
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 Deskop : System.Web.UI.Page
{
public string[] picImg = new string[7];
public string[] picName = new string[7];
DataAccess MarketBase = new DataAccess();
SqlConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
conn = new SqlConnection(MarketBase.SqlBase);
conn.Open();
DataTable dt1 = MarketBase.DisPlay_DT("select top 7 goodstitle,picpath,goodsid,protime from goods where flag='1' order by protime desc",conn);
for (int i = 0; i < dt1.Rows.Count; i++)
{
picImg[i] = "<a href='detail.aspx?goodsid="+ dt1.Rows[i][2] +"'><img src='" + dt1.Rows[i][1] + "' alt='查看详细' height='90' width='105' style='border:1px solid #848684'/></a>";
picName[i] = dt1.Rows[i][0].ToString();
}
}
}
public string Limit(string ValContent)
{
string Result_Limit;
if (ValContent.Length <= 15)
Result_Limit = ValContent;
else
Result_Limit = ValContent.Substring(0,15)+"...";
return Result_Limit;
}
}
异常详细信息: System.Data.SqlClient.SqlException: 用户 'sa' 登录失败。
源错误:
行 23: {
行 24: conn = new SqlConnection(MarketBase.SqlBase);
行 25: conn.Open();
行 26:
行 27: DataTable dt1 = MarketBase.DisPlay_DT("select top 7 goodstitle,picpath,goodsid,protime from goods where flag='1' order by protime desc",conn);
说是 conn.Open();有问题,不知道怎么改下,求高手帮忙改一下
小弟没分了。。。不好意思啊 展开
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 Deskop : System.Web.UI.Page
{
public string[] picImg = new string[7];
public string[] picName = new string[7];
DataAccess MarketBase = new DataAccess();
SqlConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
conn = new SqlConnection(MarketBase.SqlBase);
conn.Open();
DataTable dt1 = MarketBase.DisPlay_DT("select top 7 goodstitle,picpath,goodsid,protime from goods where flag='1' order by protime desc",conn);
for (int i = 0; i < dt1.Rows.Count; i++)
{
picImg[i] = "<a href='detail.aspx?goodsid="+ dt1.Rows[i][2] +"'><img src='" + dt1.Rows[i][1] + "' alt='查看详细' height='90' width='105' style='border:1px solid #848684'/></a>";
picName[i] = dt1.Rows[i][0].ToString();
}
}
}
public string Limit(string ValContent)
{
string Result_Limit;
if (ValContent.Length <= 15)
Result_Limit = ValContent;
else
Result_Limit = ValContent.Substring(0,15)+"...";
return Result_Limit;
}
}
异常详细信息: System.Data.SqlClient.SqlException: 用户 'sa' 登录失败。
源错误:
行 23: {
行 24: conn = new SqlConnection(MarketBase.SqlBase);
行 25: conn.Open();
行 26:
行 27: DataTable dt1 = MarketBase.DisPlay_DT("select top 7 goodstitle,picpath,goodsid,protime from goods where flag='1' order by protime desc",conn);
说是 conn.Open();有问题,不知道怎么改下,求高手帮忙改一下
小弟没分了。。。不好意思啊 展开
3个回答
展开全部
提示很明显啦,你的程序链接的sqlserver数据库的登录账号sa的密码是错误的,把密码改为你sqlserver的登录密码就好啦
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
很明显连接数据库失败,连接字符串有问题
更多追问追答
追问
我没学过这些东西,不知道怎么改,你能帮下忙吗?万分感激啊。。。
追答
把你的连接字符串贴出来
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
完全正确只是你没有输入用户名 function abc() { if(form1.textfield.value==
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询