Visual Studio 2019 创建Web项目时,将数据保存为CSV文件

  public void DownloadData(object sender, EventArgs e)
    {
        string connectionString = "数据库信息";

        using (MySqlConnection connection = new MySqlConnection(connectionString))
        {
            connection.Open();

            //模糊搜索
            string query = "SELECT * FROM tb_cvte_mainboard_testpoints WHERE 1=1";
            if (mohu_kehu.Text != "")
            {
                query += " AND 客户名称 LIKE '%" + mohu_kehu.Text + "%'";
            }
            if (mohu_type.Text != "")
            {
                query += " AND 器件类型 LIKE '%" + mohu_type.Text + "%'";
            }
            if (mohu_fenlei.Text != "")
            {
                query += " AND 细分类 LIKE '%" + mohu_fenlei.Text + "%'";
            }

            MySqlCommand command =

你可能感兴趣的:(Visual,Studio,2019,创建Web,visual,studio,前端,数据库)