今天做水晶报表。做了个标签的那种。。可是其中的一列怎么也不显示数据,一共有四列如下
资产编号:xxxxx
资产名称:xxxxx
部门名称:
购置日期:xxxxx
部门名称不显示,数据库中绝对有,然后相关的sql页在数据库中测试可用。且数据正确。我实在是迷茫啊。都两天了。。
下面是绑定代码 string sql = "";
if (this.radioButton1.Checked == true)
{
string da1 = this.dateTimePicker1.Text.ToString();
string da2 = this.dateTimePicker2.Text.ToString();
sql = "select MB001,MB002,MB016,MC002,ME002 from ASTMB,ASTMC,CMSME WHERE ASTMB.MB001=ASTMC.MC001 AND ASTMC.MC002=CMSME.ME001 and MB016>='" + da1 + "' AND MB016<='" + da2 + "'";
}
else if (this.radioButton2.Checked == true)
{
if (this.textBox1.Text != "")
{
string id = this.textBox1.Text.Trim();
sql = "select MB001,MB002,MB016,MC002,ME002 from ASTMB,ASTMC,CMSME WHERE ASTMB.MB001=ASTMC.MC001 AND ASTMC.MC002=CMSME.ME001 and MB001='" + id + "'";
}
else
{
MessageBox.Show("请输入数据进行查询!", "提示");
}
}
SqlConnection conn = new SqlConnection("server=192.168.0.51;database=YS999;uid=sa;pwd=5619512");
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet1 ds = new DataSet1();
da.Fill(ds, "table1");
crystalMark1 = new CrystalMark();
TableLogOnInfo LInfo = new TableLogOnInfo();
LInfo.ConnectionInfo.ServerName = "192.168.0.51";// Application.StartupPath + "eastmap.esp"
LInfo.ConnectionInfo.DatabaseName = "YS999";
LInfo.ConnectionInfo.UserID = "sa";
LInfo.ConnectionInfo.Password = "5619512";
for (int i = 0; i < crystalMark1.Database.Tables.Count; i++)
{
crystalMark1.Database.Tables[i].ApplyLogOnInfo(LInfo);
}
crystalMark1.SetDataSource(ds.Tables["table1"]);
crystalReportViewer1.ReportSource = crystalMark1;
资产编号:xxxxx
资产名称:xxxxx
部门名称:
购置日期:xxxxx
部门名称不显示,数据库中绝对有,然后相关的sql页在数据库中测试可用。且数据正确。我实在是迷茫啊。都两天了。。
下面是绑定代码 string sql = "";
if (this.radioButton1.Checked == true)
{
string da1 = this.dateTimePicker1.Text.ToString();
string da2 = this.dateTimePicker2.Text.ToString();
sql = "select MB001,MB002,MB016,MC002,ME002 from ASTMB,ASTMC,CMSME WHERE ASTMB.MB001=ASTMC.MC001 AND ASTMC.MC002=CMSME.ME001 and MB016>='" + da1 + "' AND MB016<='" + da2 + "'";
}
else if (this.radioButton2.Checked == true)
{
if (this.textBox1.Text != "")
{
string id = this.textBox1.Text.Trim();
sql = "select MB001,MB002,MB016,MC002,ME002 from ASTMB,ASTMC,CMSME WHERE ASTMB.MB001=ASTMC.MC001 AND ASTMC.MC002=CMSME.ME001 and MB001='" + id + "'";
}
else
{
MessageBox.Show("请输入数据进行查询!", "提示");
}
}
SqlConnection conn = new SqlConnection("server=192.168.0.51;database=YS999;uid=sa;pwd=5619512");
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet1 ds = new DataSet1();
da.Fill(ds, "table1");
crystalMark1 = new CrystalMark();
TableLogOnInfo LInfo = new TableLogOnInfo();
LInfo.ConnectionInfo.ServerName = "192.168.0.51";// Application.StartupPath + "eastmap.esp"
LInfo.ConnectionInfo.DatabaseName = "YS999";
LInfo.ConnectionInfo.UserID = "sa";
LInfo.ConnectionInfo.Password = "5619512";
for (int i = 0; i < crystalMark1.Database.Tables.Count; i++)
{
crystalMark1.Database.Tables[i].ApplyLogOnInfo(LInfo);
}
crystalMark1.SetDataSource(ds.Tables["table1"]);
crystalReportViewer1.ReportSource = crystalMark1;
解决方案 »
- c#调用openrowset创建的视图的问题
- vs.net 2003 怎样格式化代码呢?
- 从DataGrid到GridView遇到的问题?在线急等。。。。
- c#中dockpanel怎样使MDI子窗体平铺层叠
- 怎样实现在datagridview上编辑的数据实时的更新到datatable, 不用和数据库关联.
- 把以前的VC代码托管后,无法访问类中的变量和函数
- 一个小问题,解决就给分
- ******急— (winform)datagrid合并行与合并单元格—*****
- 在线等待:关于SqlCommandBuilder的问题
- 紧急求教——如何在SQLServer2000中实现向连接的所有客户端发出信息通告
- Object底层意义
- C#定义函数参数的小问题。。。
2、可以加个try catch看看能捕获到什么异常
还有重新编译后要把报表放到你加载的路径中
你再试试看
然后在调用页填充这个datatable。然后再赋给报表。唉,水晶报表,真是怕了。。