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
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
django之路由层(反向解析)总结
django 路由层(反向解析)03
Django 文件配置、pycharm及django连接数据库、表的增删改查 总结
Django 之 文件配置、pycharm及django连接数据库、创表及表的增删改查02
Django框架简介(1)
编程语言类别;运行Python程序的方式;变量和常量;Python程序的垃圾回收机制;
Python语法之垃圾回收机制
前端js之BOM和DOM操作
前端js之JQuery
获取当前应用信息
原文地址:https://www.cnblogs.com/virusswb/p/1205025.html
最新文章
Linux文件系统简介----转载
Windows API 编程----EnumWindows()函数的用法
Windows API-----top level window
Windows API 编程-----Windows NT 环境下禁止任务切换
Windows API 编程-----DLL编程之禁止加载自己
Windows API编程----枚举系统进程
Windows API 编程----将错误代码转换成错误描述信息
Windows核心编程(第5版)----关闭内核对象
Win7上帝模式
注册表----修改Win7登录界面
热门文章
7.13python多进程
7.11python多进程
7.11js的总结
7.11js常用对象
7.9CSS总结
7.9一个略懂皮毛学爬虫爬我不是药神影评
7.8CSS部分的学习!
7.7高阶函数
7.6批量下载网易云歌曲
django 之视图层及模板层 04
Copyright © 2011-2022 走看看