标题:dgv中为何不显示数据
取消只看楼主
C_B_Lu
Rank: 1
等 级:新手上路
威 望:1
帖 子:453
专家分:0
注 册:2006-1-10
 问题点数:0 回复次数:1 
dgv中为何不显示数据
Form的Load事件代码如下,测试时,ds.Table["Credence"]和bsCredence中都有数据,为何dgvCredence中不显示数据呀....
        private void FrmCredence_Load(object sender, EventArgs e)
        {
            Entity.Credence.GetAllCredence(ds, "Credence");
            bsCredence.DataSource = ds.Tables["Credence"];
            dgvCredence.DataSource = ds.Tables["Credence"];
        }


----------------------------------------


using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;

namespace Customs.Entity
{
    class Credence
    {
        static BaseClass.OperateData operate = new Customs.BaseClass.OperateData();

        public Credence()
        {
        }

        /// <summary>
        /// 取得所有已备案的资料
        /// </summary>
        /// <param name="ds">DataSet </param>
        /// <param name="tableName">Table name </param>
        public static void GetAllCredence(DataSet ds, string tableName)
        {
            string strSQL = "select a.item_code, a.code_t, a.g_mode, a.origin_consume, ";
            strSQL += " b.country_name, b.country_english, a.curr_code, c.curr_Name, ";
            strSQL += " a.unit_price, a.unit_code, d.unit_name, a.exp_type, a.decl_work_price,";
            strSQL += " a.work_price, a.item_type, a.edi_status, a.status,";
            strSQL += " a.auditing_content, a.appr_code, a.note_s ";
            strSQL += " from (((credence_tab a left join c_country b on a.origin_consume = b.country_code) ";
            strSQL += " left join c_curr c on a.curr_code = c.curr_code) ";
            strSQL += " left join c_unit d on a.unit_code = d.unit_code)";
            strSQL += " order by a.item_type, a.item_code";
            operate.FillDate(ds, tableName, strSQL);
        }
    }
}
搜索更多相关主题的帖子: dgv 数据 
2008-07-29 11:30
C_B_Lu
Rank: 1
等 级:新手上路
威 望:1
帖 子:453
专家分:0
注 册:2006-1-10
得分:0 
弄了一整上午,都没找出原因,现在自己又好了,真搞不懂,按说应不是连接字符串的问题,因为我都能读出记录数和数据,就是dgv中显示出不来

帮助那些真正需要帮助的人,是对帮助你的人最好的回报!
2008-07-29 14:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-225675-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.207884 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved