SQL+ASP.NET问题
using System;using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection Conn = new SqlConnection("server=localhos;DataBase=STUDENT;uid=sa;pwd=;");
Conn.Open();
SqlCommand Comm = new SqlCommand("select paswd from stu where num='" + TextBox1.Text + "'", Conn);
SqlDataReader dr = Comm.ExecuteReader();
DataGrid1.DataSource = dr;
DataGrid1.DataBind();
Conn.Close();
}
}
为什么我运行的时候,总提示我说连接不到SQL数据库?系统默认登陆的SQL数据库,用户名是系统的用户名还是SA?