一个关于SQL2000数据库连接的问题
这样一段代码写在网站的global.asax.cs文件里
protected void Session_Start(Object sender, EventArgs e)
{
SqlConnection myConn=new SqlConnection("server=485C2381458E462;uid=sa;pwd=;database=teacher-student;");
string str1="select Grade,Term,CourseID,CourseName,LearnHours from Teaching_plan";
SqlCommand SqlSele=new SqlCommand(str1,myConn);
myConn.Open();
SqlDataAdapter Adapter=new SqlDataAdapter();
Adapter.SelectCommand=SqlSele;
DataSet myDs=new DataSet();
Adapter.Fill(myDs,"Teaching_plan");
myConn.Close();
Application["TeachingTask"]=myDs;
}
运行程序后出现:
Server Error in '/' Application.
--------------------------------------------------------------------------------
SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
WebApplication1.Global.Session_Start(Object sender, EventArgs e) in C:\Inetpub\wwwroot\WebApplication1\Global.asax.cs:39
System.Web.SessionState.SessionStateModule.CompleteAcquireState() +525
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +698
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +66
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +173
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
请问怎么回事啊?????在线等,可否QQ谈????