如何把查询出来的sql结果填充到Spread
2个回答
2016-01-28 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
sql查询结果集在spread中显示:
举例如下:
System.Data.DataSet ds = new System.Data.DataSet();
DataTable name;
DataTable city;
name = ds.Tables.Add("Customers");
name.Columns.AddRange(new DataColumn[] {new DataColumn("LastName", typeof(string)), new DataColumn("FirstName", typeof(string)), new DataColumn("ID", typeof(Int32))});
name.Rows.Add(new object[] {"Fielding", "William", 0});
name.Rows.Add(new object[] {"Williams", "Arthur", 1});
name.Rows.Add(new object[] {"Zuchini", "Theodore", 2});
city = ds.Tables.Add("City/State");
city.Columns.AddRange(new DataColumn[] {new DataColumn("City", typeof(string)), new DataColumn("Owner", typeof(Int32)), new DataColumn("State", typeof(string))});
city.Rows.Add(new object[] {"Atlanta", 0, "Georgia"});
city.Rows.Add(new object[] {"Boston", 1, "Mass."});
city.Rows.Add(new object[] {"Tampa", 2, "Fla."});
FarPoint.Web.Spread.ComboBoxCellType c = new FarPoint.Web.Spread.ComboBoxCellType();
DataTable dt;
ArrayList al = new ArrayList(ds.Tables[0].Rows.Count);
dt = ds.Tables[0];
Int32 i;
for (i = 0; i <= dt.Rows.Count - 1; i++)
{
al.Add(dt.Rows[i][0]);
}
string [] s = (string[])al.ToArray(typeof(string));
c.Items = s;
FpSpread1.ActiveSheetView.Cells[0,0].CellType = c;
举例如下:
System.Data.DataSet ds = new System.Data.DataSet();
DataTable name;
DataTable city;
name = ds.Tables.Add("Customers");
name.Columns.AddRange(new DataColumn[] {new DataColumn("LastName", typeof(string)), new DataColumn("FirstName", typeof(string)), new DataColumn("ID", typeof(Int32))});
name.Rows.Add(new object[] {"Fielding", "William", 0});
name.Rows.Add(new object[] {"Williams", "Arthur", 1});
name.Rows.Add(new object[] {"Zuchini", "Theodore", 2});
city = ds.Tables.Add("City/State");
city.Columns.AddRange(new DataColumn[] {new DataColumn("City", typeof(string)), new DataColumn("Owner", typeof(Int32)), new DataColumn("State", typeof(string))});
city.Rows.Add(new object[] {"Atlanta", 0, "Georgia"});
city.Rows.Add(new object[] {"Boston", 1, "Mass."});
city.Rows.Add(new object[] {"Tampa", 2, "Fla."});
FarPoint.Web.Spread.ComboBoxCellType c = new FarPoint.Web.Spread.ComboBoxCellType();
DataTable dt;
ArrayList al = new ArrayList(ds.Tables[0].Rows.Count);
dt = ds.Tables[0];
Int32 i;
for (i = 0; i <= dt.Rows.Count - 1; i++)
{
al.Add(dt.Rows[i][0]);
}
string [] s = (string[])al.ToArray(typeof(string));
c.Items = s;
FpSpread1.ActiveSheetView.Cells[0,0].CellType = c;
2015-07-21
展开全部
--这是临时变量表
declare @table table(a varchar(20),b varchar(20))
insert into @table(a) values('a')
--实际查询语句
select a,b from @table
--测试查询语句,当无数据时用0代替
select a=isnull(a,0),b=isnull(b,0) from @table
declare @table table(a varchar(20),b varchar(20))
insert into @table(a) values('a')
--实际查询语句
select a,b from @table
--测试查询语句,当无数据时用0代替
select a=isnull(a,0),b=isnull(b,0) from @table
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询