![]() |
ASP.NET: Error message: Cannot find type _Default
Hallo,
ich habe folgende "quotes.aspx" Datei:
XML-Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="quotes.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Unbenannte Seite</title> </head> <body> <form id="form1" runat="server"> <div> <%= jo() %> </div> </form> </body> </html> und diese "quotes.aspx.cs":
Code:
Wenn ich nun auf
using System;
using System.Configuration; using MySql.Data.MySqlClient; partial class _Default : System.Web.UI.Page { static protected void Main() { } protected string jo() { MySqlConnection conn = new MySqlConnection(); conn.ConnectionString = @"Server=stdcall.de;Database=nightirc;Uid=silent;Pwd=5366;"; MySqlCommand cmd = new MySqlCommand(@"SELECT * FROM quotes;", conn); MySqlDataReader dr; string res = String.Empty; conn.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { res += dr.GetString(2) + " "; } conn.Close(); return res; } protected void Page_Load(object sender, EventArgs e) { } ![]() Zitat:
Woher kommt denn der Fehler? Die Klasse in quotes.aspx.cs heisst doch "_Default" oder nicht? |
Re: ASP.NET: Error message: Cannot find type _Default
Kann ich nicht ganz nachvollziehen. (Soll heißen: bei mir gates) Aber bennenne doch einfach die Seite so wie die ASPX? :gruebel:
Du hast auch den mySQL Provider in dem Ordner liegen? Sonst könnte er _Default nicht kompilieren und dann könnte ASPX ja nicht davon ableiten.... Was den Code angeht, rate mal wofür es using gibt und rate mal warum die ganzen Datenbank-Kraduntsches IDisposable implementieren? :roll:
Code:
using (IDbConnection connection = new MySqlConnection())
using (IDbCommand command = connection.CreateCommand()) { connection.ConnectionString = "Server=stdcall.de;Database=nightirc;Uid=silent;Pwd=5366;"; command.CommandText = "SELECT * FROM quotes"; string res = String.Empty; conn.Open(); using (IDataReader reader = command.ExecuteReader()) { while(reader.Read()) { res += reader.GetString(2) + " "; } } return res; } |
Re: ASP.NET: Error message: Cannot find type _Default
Die Sache ist die: Unter Windows funktioniert es mit dem ISS, unter Linux (SuSE 10.0) mit Mono/mod_mono und Apache nicht.
@using: Das wusste ich nicht, gleich mal abändern <g>. Dennoch wird die Seite aber nicht funktionieren :? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:52 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz