Hier der Code:
Meine Fehlermeldung: Keine Überladung für die Form1-Methode nimmt 0 Argumente an. in Program.cs
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using MySql.Data.MySqlClient; //MySQL datenbank
namespace rechnungspruefung_v1_060807
{
public partial class Form1 : Form
{
public Form1(object sender, System.Windows.Forms.ColumnClickEventArgs e)
{
#region MySQL-Connection -----------ÖFFNEN-----------------
InitializeComponent();
string connectionString =
"Server=172.16.0.13;" +
"Database=tmobile_spielwiese;" +
"Port=3306;" +
"User ID=michael;" +
"Password=xxxxxxxxxxx;" +
"Pooling=false";
IDbConnection dbconn;
dbconn = new MySqlConnection(connectionString);
dbconn.Open();
IDbCommand dbcmd = dbconn.CreateCommand();
string query = "select tmobile_rechnung20070706.rufnummer, tmobile_rechnung20070706.grundentgelt + tmobile_rechnung20070706.verbindungsentgelte + tmobile_rechnung20070706.sonstige_entgelte + tmobile_rechnung20070706.gutschriften as entgelte_tma, tmobile_egn20070706.tarif AS tma_tarif, services_06_07.tarif as dialog_tarif FROM tmobile_rechnung20070706 LEFT JOIN tmobile_egn20070706 ON (tmobile_rechnung20070706.rufnummer = tmobile_egn20070706.rufnummer) LEFT JOIN services_06_07 ON (tmobile_rechnung20070706.rufnummer=services_06_07.anummer)";
dbcmd.CommandText = query;
IDataReader reader = dbcmd.ExecuteReader();
#endregion
#region Ausgabe ---------------------------------------
while (reader.Read())
{
string rufnummer = (string)reader["rufnummer"];
string tma_tarif = (string)reader["tma_tarif"];
string entgelte_tma = Convert.ToString((double)reader["entgelte_tma"]);
string dialog_tarif = "not found";
if (reader.IsDBNull(3) != true)
{
dialog_tarif = (string)reader["dialog_tarif"];
}
string entgelte_dialog = "";
#region TARIF - OK
string tarif_ok = "!NOT OK!";
if (tma_tarif == "Wholesale Mobile Internet S" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Wholesale Mobile Internet" & dialog_tarif == "Mobile Internet Mobil")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Wholesale Mobile Internet XL" & dialog_tarif == "Mobile Internet XL")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Wholesale Mobile Internet XL" & dialog_tarif == "Mobile Internet XL")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Mobile Internet Medium" & dialog_tarif == "Mobile Internet Mobil")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet" & dialog_tarif == "Mobile Internet Mobil")
{
tarif_ok = "Gutschrift";
}
else
{
if (tma_tarif == "Rabatt auf Grundgebühr" & dialog_tarif == "Mobile Internet Mobil")
{
tarif_ok = "Rabatt auf Grundgebühr";
}
else
{
if (tma_tarif == "Rabatt auf Grundgebühr" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "Rabatt auf Grundgebühr";
}
else
{
if (tma_tarif == "Rabatt auf Grundgebühr" & dialog_tarif == "Mobile Internet XL")
{
tarif_ok = "Rabatt auf Grundgebühr";
}
else
{
if (tma_tarif == "Mobile Internet Small" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet XL" & dialog_tarif == "Mobile Internet Mobil")
{
tarif_ok = "Gutschrift";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet XL" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "Gutschrift";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet XL" & dialog_tarif == "Mobile Internet XL")
{
tarif_ok = "Gutschrift";
}
else
{
if (tma_tarif == "Wholesale Mobile Internet" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "OK";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet S" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "Gutschrift";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet" & dialog_tarif == "Mobile Internet Small")
{
tarif_ok = "Gutschrift";
}
else
{
if (tma_tarif == "Gutschrift Wholesale Mobile Internet S" & dialog_tarif == "Mobile Internet Mobil")
{
tarif_ok = "Gutschrift";
}
else
{
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// TARIF - OK ---------------------------------------------------------------------------------------
#endregion
ListViewItem x = new ListViewItem(new string[] { rufnummer, tma_tarif, "€ "+entgelte_tma, dialog_tarif, entgelte_dialog, tarif_ok });
if (tarif_ok == "!NOT OK!")
{
x.BackColor = Color.Red;
x.ForeColor = Color.White;
lv_ausgabe.Items.Add(x);
lv_ausgabe.Sort();
}
ListViewItemComparer sorter = new ListViewItemComparer(e.Column);
lv_ausgabe.ListViewItemSorter = sorter;
lv_ausgabe.Sort();
}
#endregion
#region MySQL-Connection -----------SCHLIESSEN-----------------
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbconn.Close();
dbconn = null;
#endregion
}
private void Lv_ausgabe_ColumnClick(object sender,
System.Windows.Forms.ColumnClickEventArgs e, System.Windows.Forms.ListView lv_ausgabe)
{
ListViewItemComparer sorter = new ListViewItemComparer(e.Column);
lv_ausgabe.ListViewItemSorter = sorter;
lv_ausgabe.Sort();
}
private void Form1_Load(object sender, EventArgs e) { }
}
}
public class ListViewItemComparer : IComparer
{
private int column;
private bool numeric = false;
public int Column
{
get { return column; }
set { column = value; }
}
public bool Numeric
{
get { return numeric; }
set { numeric = value; }
}
public ListViewItemComparer(int columnIndex)
{
Column = columnIndex;
}
public int Compare(object x, object y)
{
ListViewItem listX = (ListViewItem)x;
ListViewItem listY = (ListViewItem)y;
if (Numeric)
{
// Convert column text to numbers before comparing.
// If the conversion fails, just use the value 0.
decimal listXVal, listYVal;
try
{
listXVal = Decimal.Parse(listX.SubItems[Column].Text);
}
catch
{
listXVal = 0;
}
try
{
listYVal = Decimal.Parse(listY.SubItems[Column].Text);
}
catch
{
listYVal = 0;
}
return Decimal.Compare(listXVal, listYVal);
}
else
{
// Keep the column text in its native string format
// and perform an alphabetic comparison.
string listXText = listX.SubItems[Column].Text;
string listYText = listY.SubItems[Column].Text;
return String.Compare(listXText, listYText);
}
}
}
Meine Fehlermeldung: Keine Überladung für die Form1-Methode nimmt 0 Argumente an. in Program.cs