zoukankan
html css js c++ java
使用webservice获得天气,基金,股票等信息 Virus
protected
void
Button1_Click(
object
sender, EventArgs e)
{
cn.com.webxml.www.WeatherWebService weather
=
new
cn.com.webxml.www.WeatherWebService();
string
[] weathers
=
weather.getWeatherbyCityName(
"
58367
"
);
this
.TextBox1.Text
=
weathers[
10
].ToString();
cn.com.webxml.www.ChinaOpenFundWS fund
=
new
cn.com.webxml.www.ChinaOpenFundWS();
DataSet ds
=
fund.getFundCodeNameDataSet();
this
.GridView1.DataSource
=
ds.Tables[
0
].DefaultView;
this
.GridView1.DataBind();
cn.com.webxml.www.ChinaStockSmallImageWS stock
=
new
cn.com.webxml.www.ChinaStockSmallImageWS();
byte
[] b
=
stock.getSmallImageByte(
"
sh000001
"
,
byte
.MaxValue);
Random random
=
new
Random();
string
imageName
=
random.Next().ToString()
+
"
.jpg
"
;
string
myUrl
=
HttpContext.Current.Server.MapPath(
this
.Request.ApplicationPath)
+
imageName;
FileStream fs
=
new
FileStream(myUrl, FileMode.OpenOrCreate);
BinaryWriter w
=
new
BinaryWriter(fs);
w.BaseStream.Write(b,
0
, b.Length);
w.Flush();
w.Close();
this
.Image1.ImageUrl
=
Context.Request.ApplicationPath
+
imageName;
System.Drawing.Bitmap bitmap
=
new
System.Drawing.Bitmap(myUrl);
this
.Image1.Width
=
bitmap.Width;
this
.Image1.Height
=
bitmap.Height;
}
给大家介绍一个很好的网站,提供了一些常用的web服务,例如时刻表,天气,基金,股票,IP等,大家可以自己去看看。
http://www.webxml.com.cn/zh_cn/web_services.aspx
下面我演示一个例子,获取天气,基金列表和股票走势图,具体的基金值需要联系网站,用他分配的用户名做参数才可以访问。
【Blog】
http://virusswb.cnblogs.com/
【MSN】
jorden008@hotmail.com
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
2491 玉蟾宫
1704 卡片游戏
1020 孪生蜘蛛
1215 迷宫
3149 爱改名的小融 2
1316 文化之旅 2012年NOIP全国联赛普及组
1664 清凉冷水
157. [USACO Nov07] 奶牛跨栏
[SCOI2005]繁忙的都市
【NOIP2014模拟赛No.1】我要的幸福
原文地址:https://www.cnblogs.com/virusswb/p/1205025.html
最新文章
第20章 Redis配置
java8新特性系列:[1]让你的eclipse支持java8
第19章 Redis的一些常用技术
第18章 Redis数据结构常用命令
第17章 Redis概述
Spring MVC的文件上传和下载
第6章 Spring MVC的数据转换、格式化和数据校验
Spring MVC简介 2.5 Spring MVC执行的流程
Linux查看内置命令和非内置命令帮助的几种方法(man、help、info)
Linux查看内置命令和非内置命令帮助的几种方法(man、help、info)
热门文章
Linux查看内置命令和非内置命令帮助的几种方法(man、help、info)
使用validate.js实现表单数据验证
使用validate.js实现表单数据验证
使用validate.js实现表单数据验证
为什么数据库字段尽可能用NOT NULL,而不是NULL
为什么数据库字段尽可能用NOT NULL,而不是NULL
为什么数据库字段尽可能用NOT NULL,而不是NULL
域名相关的一些基础知识
codevs 5790 素数序数
关于数论的整理
Copyright © 2011-2022 走看看