我爱Aspx >> C#.Net >> C# Operate Excel Filetry
{
string s="select * from Name.TableName";
OleDbCommand cmd=new OleDbCommand (s,cn);
OleDbDataReader dr=cmd.ExecuteReader ();
Excel.Application xlApp = new Excel.Application();
if(xlApp==null){MessageBox.Show ("Can't open Excel!");return;}
xlApp.Application .Workbooks .Add (true);
int row=2,fieldcount;
fieldcount=dr.FieldCount ;
for(int col=0;col<fieldcount;col++) xlApp.Cells [1,col+1]=dr.GetName(col);
while (dr.Read ())
{
for(int col=0;col<fieldcount;col++)
xlApp.Cells [row,col+1]=dr.GetValue(col).ToString();
row++;
}
xlApp.Visible =true;
xlApp=null;
}
catch(Exception ex ){MessageBox.Show (ex.Message );}
finally {cn.Close();}
}
catch(Exception ex){MessageBox.Show (ex.Message );}
}
}
Ҷƪл˵?
用C#编写读取和添加xml数据[07-06]
C# 传结构体数组到C++dll中[07-06]
C#的学习路程[07-06]
C#里能使用MFC扩展的dll中的类吗[07-06]
请问:如何用C#生成一个完整的xm..[07-06]
C#中,如何读取ORACLE的表中的BL..[07-06]
c#中如何获取结构型的指针???..[07-06]
vc#写的winform程序很占内存,如..[07-06]
请教c#+access 登录的问题[07-06]
C#调用delphi制作的dll(非标准CO..[07-06]
火影忍者239话在线观看[07-29]
火影忍者238话在线观看[07-29]
火影忍者237 在线观看[07-29]
火影忍者236话在线观看[07-29]
把单个aspx文件编译成DLL[07-20]
百度PKGoogle人机交互[07-20]
酷6股权换百度流量[07-20]
火影忍者235 杀手锏![07-12]
sqlserver的问题,占用内存逐渐升..[07-06]
请问,QQ相册的图片怎么生成的?..[07-06]