以下是读取EXCEL内容并和水晶报表绑定显示,之前做了一个和DataGrid绑定没有问题。string strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties='Excel 8.0;HDR=yes;IMEX=1';";
OleDbConnection mycon = new OleDbConnection(strcon);
string strcom = "select * from ["SHEET1"]";
mycon.Open();
OleDbDataAdapter mycommand = new OleDbDataAdapter(strcom, mycon);
DataSet ds = new DataSet();
DataTable tbl = new DataTable("sdf");
mycommand.Fill(tbl);
ds.Tables.Add(tbl); ;
CrystalReport1 rep = new CrystalReport1();
rep.SetDataSource(ds);
提示:该报表不包含表Datatable里是有内容的,怎么会提示这个?
OleDbConnection mycon = new OleDbConnection(strcon);
string strcom = "select * from ["SHEET1"]";
mycon.Open();
OleDbDataAdapter mycommand = new OleDbDataAdapter(strcom, mycon);
DataSet ds = new DataSet();
DataTable tbl = new DataTable("sdf");
mycommand.Fill(tbl);
ds.Tables.Add(tbl); ;
CrystalReport1 rep = new CrystalReport1();
rep.SetDataSource(ds);
提示:该报表不包含表Datatable里是有内容的,怎么会提示这个?
解决方案 »
- 关于生成手机号的问题
- ado.net访问sqlserver不出现在profiler中
- 两个字符串的相似度计算
- 为什么程序中打开线程后再关闭线程,线程数却多了2个呢?
- 公布一个模仿VB中InputBox的解决源码
- 构造函数应该什么情况下用到?有什么优势和作用?
- 请问一下C#里面指针可不可以用阿?
- c# 编写的sato条码打印程序,打印时会跳纸,少出来几个条码
- c#程序在自己机子可以运行,在其他没装过C#的机子上运行提示,程序初始化失败,怎么回师?
- 一个很弱的调试DLL问题
- 有没有大神进来帮小弟一把 在线等
- 请用过DirectX.Capture的朋友进来看看啊,如何1分钟录一个文件呢?我现在是重复new一个Capture对象,但是运行了几个小时后出错了.
看这个帖子,最后结果是“疯了,终于知道什么原因了,设计的report.rpt和bin\debug\下的report.rpt结构不一致。”不知你是不是这个原因