技术开发 频道

使用webservice获得天气,基金,股票等信息


【IT168技术文档】

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; }
0
相关文章