软件应用程序部署

时间:2019-07-15 07:18:45

标签: c# mysql visual-studio localhost

我已经使用Visual Studio开发了应用程序软件。 c#是前端,MySQL是后端。我已经在主机系统中使用了wamp服务器。我想将其部署在为其创建了可执行文件的客户端系统中。但是我无法在客户端系统中安装和运行它。 我需要一种解决方案来创建可执行文件并在客户端系统中运行它,而无需在客户端系统中进行任何额外下载。请帮助

我使用第三方软件“ Advanced Installer”进行了尝试。我使用此软件创建了(.exe)文件,但无法正常工作。  我还尝试在Visual Studio中发布该项目,但该项目也无法正常工作。

    private void button1_Click(object sender, EventArgs e)
    {
        MySqlConnection con = new MySqlConnection("server = localhost; user id = root;password=admin123 ; database = jivasci_project");
        con.Open();

        if (textBoxDate.Text == "" || textBoxTime.Text == "" || textBoxTime.Text == "" || mfd_manu.Text == "" || mfd_mat.Text == "" || mfd_focus.Text == "" || mfd_id_tb.Text == "" ||
             fld_sample.Text == "" || fld_samp_source.Text == "" || fld_samp_conc.Text == "" || fld_samp_stain.Text == "" || fld_stain_conc.Text == "" || fld_sheath1.Text == "" ||
            fld_sheath2.Text == "" || fld_samp_flow_rate.Text == "" || fld_sheath1_flow_rate.Text == "" || fld_sheath2_flowrate.Text == "" || las_exci_laser.Text == "" || las_las_pow.Text == "" ||
            las_exci_mode.Text == "" || las_abli_las.Text == "" || las_abli_pow.Text == "" || aq_sensor1.Text == "" || aq_sensor2.Text == "" || aq_det_mode1.Text == "" ||
             aq_det_pos1.Text == "" || aq_det_mode2.Text == "" || aq_det_pos2.Text == "" || aq_sensor_gain1.Text == "" || aq_sensor_gain2.Text == "" || aq_filt_sensor1.Text == "" || aq_filt_sensor2.Text == "" ||
             ele_data_aq.Text == "" || ele_samp_time.Text == "" || ele_data_aq_time.Text == "")
        {
            MessageBox.Show("Please fill the empty fields");
        }

        else
        {
            DialogResult myresult2;
            myresult2 = MessageBox.Show("Is everything correct?", "Save Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (myresult2 == DialogResult.OK)
            {
                try
                {
                    MySqlCommand cmd = new MySqlCommand("INSERT INTO exp_gui (`Date`, `Time`, `MFDManufacturer`, `MFDMaterial`," +
                        " `MFDFocusing`, `MFDID`, `Sample`, `Sample Source`, `SampleConctn`, `SampleStaining`, `Stainingconctn`, " +
                        "`Sheath1`, `Sheath2`, `SampleFlowRate`, `Sheath1FlowRate`, `Sheath2FlowRate`, `Sample Dispenser`, " +
                        "`Sheath1Dispenser`, `Sheath2Dispenser`, `ExcitationLaser`, `ExcitationLaserPower`, `ExcitationMode`," +
                        " `ExcitationPosition`, `AblationLaser`, `AblationLaserPower`, `Sensor1`, `Sensor2`, `Detection Mode1`, " +
                        "`Detection Position1`, `Detection Mode2`, `Detection Position2`, `Sensor 1 gain`, `Sensor 2 gain`, " +
                        "`Filterforsensor 1`, `Filterforsensor 2`, `DataAcquisitionSystem`, `SamplingTime(us)`, `DataAcquisitionTime`)" +
                        " VALUES ('" + textBoxDate.Text + "','" + textBoxTime.Text + "','" + mfd_manu.Text + "','" + mfd_mat.Text + "'" +
                        ",'" + mfd_focus.Text + "','" + mfd_id_tb.Text + "','" + fld_sample.Text + "','" + fld_samp_source.Text + "'," +
                        "'" + fld_samp_conc.Text + "','" + fld_samp_stain.Text + "','" + fld_stain_conc.Text + "','" + fld_sheath1.Text + "'," +
                        "'" + fld_sheath2.Text + "','" + fld_samp_flow_rate.Text + "','" + fld_sheath1_flow_rate.Text + "'," +
                        "'" + fld_sheath2_flowrate.Text + "','" + fld_samp_dispn.Text + "','" + fld_sheath1_dispn.Text + "'," +
                        "'" + fld_sheath2_dispn.Text + "','" + las_exci_laser.Text + "','" + las_las_pow.Text + "'," +
                        "'" + las_exci_mode.Text + "','" + las_exci_pos.Text + "','" + las_abli_las.Text + "'," +
                        "'" + las_abli_pow.Text + "'," +
                        "'" + aq_sensor1.Text + "','" + aq_sensor2.Text + "','" + aq_det_mode1.Text + "'," +
                        "'" + aq_det_pos1.Text + "','" + aq_det_mode2.Text + "','" + aq_det_pos2.Text + "'," +
                        "'" + aq_sensor_gain1.Text + "','" + aq_sensor_gain2.Text + "','" + aq_filt_sensor1.Text + "'," +
                        "'" + aq_filt_sensor2.Text + "'," +
                        "'" + ele_data_aq.Text + "','" + ele_samp_time.Text + "'," +
                        "'" + ele_data_aq_time.Text + "')", con);

                    cmd.ExecuteNonQuery();

                    MessageBox.Show("saved to database successfully ");

                }
                catch (Exception ex)
                {
                    MessageBox.Show("something went wrong!!!!!!!!" + ex);
                }
            }
            else
            {

            }

        }

        con.Close();
    }

没有错误或警告,但已安装的应用程序无法正常工作。

0 个答案:

没有答案