而且,运行时有这些显示出来:Source Error:
Line 15:
Line 16: DS = new DataSet()
Line 17: MyCommand.Fill(ds, "Authors")
Line 18:
Line 19: MyDataGrid.DataSource=DS.Tables("Authors").DefaultView
Source File: D:\movics\asp.net\WebForm1.aspx Line: 17 Stack Trace:
[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.SqlConnection.Open() +665
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +95
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +102
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
ASP.WebForm1_aspx.Page_Load(Object Sender, EventArgs E) in D:\movics\asp.net\WebForm1.aspx:17
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +73
System.Web.UI.Page.ProcessRequestMain() +394
Line 15:
Line 16: DS = new DataSet()
Line 17: MyCommand.Fill(ds, "Authors")
Line 18:
Line 19: MyDataGrid.DataSource=DS.Tables("Authors").DefaultView
Source File: D:\movics\asp.net\WebForm1.aspx Line: 17 Stack Trace:
[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.SqlConnection.Open() +665
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +95
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +102
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
ASP.WebForm1_aspx.Page_Load(Object Sender, EventArgs E) in D:\movics\asp.net\WebForm1.aspx:17
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +73
System.Web.UI.Page.ProcessRequestMain() +394
dim ds as new dataset()
在用 Mycommand.fill(ds,"table")
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.
如果你是用Trusted_Connection=yes,必须在sql Server上创建名为ASPNET的用户,比给出相应的权限(查看 修改等)或者你是用混合模式连接sql Server:
SqlConnection("server=localhost\NetSDK;database=pubs;uid=sa;pwd=")