2011-11-29 19 views
1

我是這種編程語言的新手,我需要幫助。不太確定什麼是錯的。但它一直提示下面的錯誤,它不會顯示來自MySQL工作臺數據庫的數據。ASP.net - 無法加載類型Nname.name

Server Error in '/' Application. 
-------------------------------------------------------------------------------- 

Parser Error 
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: Could not load type 'Nname.name'. 

Source Error: 

Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="name.Master.cs" Inherits="Nname.name" %> 

這是我的表單頁面:

<asp:Content ID="Content2" ContentPlaceHolderID="phContent" runat="server"> 
    <table> 
     <tr> 
      <th> 
       ID 
      </th> 
      <th> 
       Name 
      </th> 
      <th> 
       Country Code 
      </th> 
      <th> 
       Disctrict 
      </th> 
      <th> 
       Population 
      </th> 
     </tr> 
     <tr class="large"> 
      <td> 
       <asp:Label ID="ID" runat="server" Text=""></asp:Label> 
      </td> 
      <td> 
       <asp:Label ID="Name" runat="server" Text=""></asp:Label> 
      </td> 
      <td> 
       <asp:Label ID="CountryCode" runat="server" Text=""></asp:Label> 
      </td> 
      <td> 
       <asp:Label ID="District" runat="server" Text=""></asp:Label> 
      </td> 
      <td> 
       <asp:Label ID="Population" runat="server" Text=""></asp:Label> 
      </td> 
     </tr> 
    </table> 
</asp:Content> 

這是我的數據庫代碼:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Data; 
using System.Data.SqlClient; 
using MySql.Data; 
using MySql.Data.MySqlClient; 

namespace P1 
{ 
    public class records 
    { 
     MySqlConnection con = null; 
     MySqlCommand cmd = null; 
     MySqlDataReader rdr ; 
     //DataSet ds = new DataSet(cmd,con); // 
     MySqlDataAdapter da = new MySqlDataAdapter(); 

     public void read() 
     { 
      try 
      { 
       con = new MySqlConnection("Server=myServerName;Database=myDatabaseName;Uid=myID;Pwd=myPassword"); 

       con.Open(); 

       string cmd = "SELECT * FROM city WHERE ID=6;"; 

       //da.Fill(ds); 
       con.Close(); 
      } 
      catch() 
      { } 
     } 
    } 
} 

回答

0

你需要編輯母版頁和變更

Inherits="Nname.name" 

Inherits="name.name" 

Inherits="name.master" 
+0

它仍然不工作 – fzh

+0

什麼是代碼隱藏母版頁的名稱空間和類?這就是你在繼承中輸入的內容。 –

+0

所以繼承將是namepsace的名稱。班級的名字? – fzh

相關問題