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
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
转载:SQL Server错误 2812 :未能找到存储过程 ***的解决方法
转载:mysql5.7设置不区分大小写
无法对数据库'XXX' 执行删除,因为它正用于复制"
Win7 64位 部分软件和文档字体显示乱码
转载:创建对于用户sa失败,sa无法映射到数据库
sqlserver 用户角色权限
转发:Nginx可视化配置工具—NginxWebUI
docker-compose安装
导入导出windows 防火墙规则
python 打包pyinstaller 问题记录
原文地址:https://www.cnblogs.com/virusswb/p/1205025.html
最新文章
arduino开发ESP8266学习笔记三———呼吸灯
input框输入金额显示逗号分隔,显示百分位
POST提交无法提交到后台controller的方法, POST http://localhost:8080/
ORACLE的user_jobs定时任务创建,user_jobs定时任务不执行,
ORACLE字符串截取
如何通过反射获取静态常量类中的各个值
使用String.format()格式化字符串,java自动补全自增长字符串
layui子页面获取父页面对象并传值,设值
layui获取当前行点击对象和行数
java中如何判断数组中是否包含某一字符串元素
热门文章
table里面隐藏td的边框线
mysql应当尽量避免使用null
shell脚本执行php文件注意php文件中的路径问题
windows配置php的环境变量
php强制文件下载
php多维数组进行多次排序
php修改上传文件大小限制
const和define()的区别
navicat 不显示填充0
无法用排他锁锁定该数据库,以执行该操作。 (Microsoft SQL Server,错误: 5030)
Copyright © 2011-2022 走看看