【问题标题】:Datagrid not updating数据网格不更新
【发布时间】:2010-11-20 01:44:55
【问题描述】:
        con.Open();
        MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM `call`", con);
        DataSet dataset = new DataSet();
        adapter.Fill(dataset, "call");

        dataGridView1.DataSource = dataset;
        dataGridView1.Update();

这是上面的代码

它运行良好,但数据网格中没有任何内容:(

任何帮助将不胜感激

【问题讨论】:

    标签: c# mysql datagrid


    【解决方案1】:

    当指向 DataSet 时,DataGridView 将不起作用。您必须将其指向一个 DataTable

    将您的代码更改为:

    
    dataGridView1.DataSource = dataset.Tables["call"];
    

    【讨论】:

    • wooot love :D(还剩 585 个字符)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-06
    • 2012-12-24
    • 1970-01-01
    • 2011-11-02
    • 2018-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多