代码如下,为什么会出错呢?
'source code: pagedata.aspx
<!--form\web form demo\pagedata.aspx-->
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQL" %>
<html>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As SQLConnection
Dim MyCommand As SQLDataSetCommand
'connect sql server
MyConnection = New SQLConnection("server='datacenter';uid=sa;pwd=;database=info")
'execut SQL 
MyCommand = New SQLDataSetCommand("select * from infor",MyConnection)
DS = New DataSet()
MyCommand.FillDataSet(ds, "infor")
MyDataGrid.DataSource=ds.Tables("infor").DefaultView
MyDataGrid.DataBind()
End Sub
</script>
<center>
<body>
<h3><font face="Verdana">Page_load Event Demo</font></h3>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="600"
BackColor="white"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
MaintainState="false"
/>
/body>
</center>
</html>

解决方案 »

  1.   

    Server Error in '/' Application.
    --------------------------------------------------------------------------------Runtime Error 
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
    <!-- Web.Config Configuration File --><configuration>
        <system.web>
            <customErrors mode="Off"/>
        </system.web>
    </configuration>
     Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
    <!-- Web.Config Configuration File --><configuration>
        <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
        </system.web>
    </configuration>
     
      

  2.   

    这个好像是应用程序错误
    你吧webconfig中的
     <customErrors mode="Off" >
        </customErrors> 
    mode设置为Off,看看具体错误在哪里
      

  3.   

    <configuration>
        <system.web>
            <customErrors mode="Off"/>
        </system.web>
    </configuration>
    先把这个改过来看看。估计是你的SQL SERVER2000安装错误。右击SQL SERVER企业管理器,看一下属性--〉安全性。身份验证一定要是SQLserver和windows,仅windws是错误的!最好卸载了重装,一定要选SQLserver和windows,sa密码要选空!这样就ok了
      

  4.   

    不好意思,再问一句,webconfig在哪里? 懒的翻书了,俺是vc程序员,老板让我学学asp.net,晕!
      

  5.   

    在C:\Inetpub\wwwroot\News下找到一个Web.config,是要在自己的目录下建一个吗?
      

  6.   

    Compilation Error 
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30002: Type 'SQLConnection' is not defined.Source Error: Line 8:  Sub Page_Load(Src As Object, E As EventArgs)
    Line 9:  Dim DS As DataSet
    Line 10: Dim MyConnection As SQLConnection
    Line 11: Dim MyCommand As SQLDataSetCommand
    Line 12: 'connect sql server
     Source File: c:\inetpub\wwwroot\andy\pagedata.aspx    Line: 10
      

  7.   

    <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %><script language="VB" runat="server">
    Sub Page_Load(Src As Object, E As EventArgs)Dim MyConnection As New SQLConnection("server=127.0.0.1;uid=sa;pwd=***;database=***")Dim MyCommand As New SQLCommand("select * from infor",MyConnection)MyConnection.Open()Dim DS As New DataSet()Dim ADP As New SqlDataAdapter(MyCommand)ADP.Fill(DS, "infor")MyDataGrid.DataSource=DS.Tables("infor").DefaultViewMyDataGrid.DataBind()MyConnection.Close()End Sub
    </script><html>
    <body>
    <center>
    <h3><font face="Verdana">Page_load Event Demo</font></h3>
    <ASP:DataGrid id="MyDataGrid" runat="server"
    Width="600"
    BackColor="white"
    BorderColor="black"
    ShowFooter="false"
    CellPadding=3
    CellSpacing="0"
    Font-Name="Verdana"
    Font-Size="8pt"
    HeaderStyle-BackColor="#aaaadd"
    MaintainState="false"
    />
    </body>
    </center>
    </html>
      

  8.   

    把<%@ Import Namespace="System.Data.Sql" %>改为<%@ Import Namespace="System.Data.SqlClient" %>后
    Type 'SQLConnection' is not defined错误没有了,后面一句又出错了。SQLDataSetCommand这个类不知在哪里? msdn里也没找到!NetStarStudio(网星工作室) 的代码可用,谢谢各位的帮助!