ASP.net - не удалось загрузить тип Nname.name - PullRequest
1 голос
/ 29 ноября 2011

Я новичок в этом языке программирования, и мне нужна помощь с этим.Не очень уверен, что не так.Но он продолжал выдавать сообщение об ошибке ниже и не отображал данные из базы данных MySQL Workbench.

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()
            { }
       }
   }
}

1 Ответ

0 голосов
/ 29 ноября 2011

Вам нужно отредактировать свою главную страницу и изменить

Inherits="Nname.name"

на

Inherits="name.name"

или

Inherits="name.master"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...