我在 1and1.com 有一个窗口托管。我尝试使用以下代码连接数据库,但收到错误消息。您可以在此处查看错误消息http://www.s499993321.onlinehome.us/Default.aspx
有没有人知道发生?如何连接数据库?
protected void Page_Load(object sender, EventArgs e)
{
using (SqlConnection cn = new SqlConnection("Server=localhost; Database=db500148144; User Id=dbo500148144; Password=12345abc"))
{
cn.Open();
SqlCommand cmd = new SqlCommand("SELECT COUNT(*) FROM people", cn);
SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
rdr.Read();
Response.Write(rdr[0].ToString());
}
// Response.Write("How");
}