C_B_Lu 发布留言 2008-7-29 11:30
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()
{
}
///
/// 取得所有已备案的资料
/// ///
DataSet
///
Table name
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);
}
}
}
师妃暄 发布留言 2008-7-29 11:42
这几行代码我没看出什么问题来。。。。
C_B_Lu 发布留言 2008-7-29 14:00
弄了一整上午,都没找出原因,现在自己又好了,真搞不懂,按说应不是连接字符串的问题,因为我都能读出记录数和数据,就是dgv中显示出不来
xyq701830 发布留言 2008-7-29 15:27
估计是出错过了你没有重新生成吧.里面还是老样子的所以读不出来也有可能
页: [1]