而且,运行时有这些显示出来: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 

解决方案 »

  1.   

    这样声明dataset看看
    dim ds as new dataset()
    在用 Mycommand.fill(ds,"table")
      

  2.   

    可能是你的sqlserver设置问题,你用的是windows信任连接嘛?确信???
      

  3.   

    写出Source Error: 前的出错提示
      

  4.   

    Source Error: 前的出错提示是如下:
    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.
      

  5.   

    这是你没有连接上sql server!
    如果你是用Trusted_Connection=yes,必须在sql Server上创建名为ASPNET的用户,比给出相应的权限(查看 修改等)或者你是用混合模式连接sql Server:
    SqlConnection("server=localhost\NetSDK;database=pubs;uid=sa;pwd=")
      

  6.   

    我给分啦。问题解决啦,主要是connectionstring的问题。