如何使用C#从MySQL检索后以表格形式显示填充的DataSet?

时间:2018-03-10 01:26:52

标签: c# mysql wpf database-connection

我试图找出如何引出某种表来查看已填充的DataSet。我无法正确地将代码可视化。

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace Decoupled_Data
{
    class Program
    {
        static void Main(string[] args)
        {
            string connStr =
                "server=localhost; user=root; database=job_ticket_foil_summary;port=3306;password=ttnstamping";
            MySqlConnection conn = new MySqlConnection(connStr);

            DataSet dsCountry = new DataSet();

            string sql = "SELECT * FROM jt_foil_summary";
            MySqlDataAdapter daCountry = new MySqlDataAdapter(sql, conn);

            MySqlCommandBuilder cb = new MySqlCommandBuilder(daCountry);

            daCountry.Fill(dsCountry, "jt_foil_summary");

            //Table of Data should appear here

            Console.ReadLine();
        }
    }
}

0 个答案:

没有答案