如何为此 C# 程序创建 exe 文件。我确实尝试创建一个 exe 文件,但发生了一些错误,错误是,
'WindowsFormsApplication11.save' does not contain a definition for 'save_Load' and no extension method 'save_Load' accepting a first argument of type 'WindowsFormsApplication11.save' could be found (are you missing a using directive or an assembly reference?)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using MySql.Data.MySqlClient;
namespace WindowsFormsApplication11
{
public partial class save : Form
{
public save()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string myConnection = "datasource=localhost;port=3306;username=root;Password=root";
string query = "insert into store_data.item_details (item_id,item_name,item_qty,item_price) values('" + this.id_txt.Text + "','" + this.name_txt.Text + "','" + this.qty_txt.Text + "','" + this.price_txt.Text + "');";
MySqlConnection connection = new MySqlConnection(myConnection);
MySqlCommand cmdsave = new MySqlCommand(query, connection);
MySqlDataReader dataReader;
try
{
connection.Open();
dataReader = cmdsave.ExecuteReader();
MessageBox.Show("your Data has been saved ");
while (dataReader.Read())
{
}
connection.Close();
}
catch (Exception excep)
{
MessageBox.Show(excep.Message);
}
}
}
}