Problem med windows form - no suitable method found to override
Jeg har denne simple kode stump:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : System.Windows.Forms.Form
{
static void Main()
{
string MyConnection = "server=localhost;uid=xxxx;" +
"pwd=xxxx;database=Test";
MySql.Data.MySqlClient.MySqlConnection Con;
MySql.Data.MySqlClient.MySqlCommand Com;
Con = new MySql.Data.MySqlClient.MySqlConnection();
Com = new MySql.Data.MySqlClient.MySqlCommand();
Con.ConnectionString = MyConnection;
try
{
Con.Open();//Åbner forbindelse til databasen
Com.Connection = Con;
Com.CommandText = "INSERT INTO tt VALUES ('nyt forsøg5')";//Table name defineres
Com.Prepare();
Com.Parameters.Add("tt", "Test"); //Definerer henholdsvis hvilken table og db der skal anvendes
Com.ExecuteNonQuery();
Con.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
Og jeg får denne fejl:
Error 1 'DBConnect.Form1.Dispose(bool)': no suitable method found to override
Hvordan skal jeg tackle det?!?