我爱Aspx >> C#.Net >> 股票报价的WebService之四创建 Web应用程序用户
下面创建一个Web应用程序StockConsumer.ASPx,它作为这个StockQuote(股票报价) Web服务的第一个用户。
<%@ Page language="C#" %>
<%@ Import Namespace="System.XML" %>
<%@ Import Namespace="Quotes" %>
以上引入必要的名称空间。要记住也要引入 Quotes名称空间,它是代理库的名称空间。
<html>
<head>
<script runat=server>
// Wire up the onClick event for a button
protected void button1_Click(object sender, EventArgs e)
{
file://Create a object of the class DailyStock (the proxy class)
DailyStock ds = new DailyStock();
// Call the GetQuote method of the proxy class DailyStock and
// pass the symbol string from the textbox
string res = ds.GetQuote(symbol.Text);
// The returned string has values which are separated
// by commas.
// Hence we split the returned string into parts
char[] splitter = {','} ;
string[] temp = res.Split(splitter);
// Check if the string array returned has more than one
// elements since if there are less than one elements
// then an exception must have been returned
if(temp.Length >1)
{
// The WebService returns a lot of information about the
// stock. We only show the relevant portions
// Set the label to current Index
curindex.Text = "Current Index :"+temp[1];
// Set the label to current Date Time
curdate.Text ="Last Update on"+temp[2]+" at "+temp[3];
Ҷƪл˵?
.NET之ASP Web Application快速入..[05-12]
.NET之ASP Web Services 快速入门[05-12]
轻松加密ASP.NET 2.0 Web程序配置..[05-12]
web应用程序中的数据库连接(2)[05-12]
web应用程序中的数据库连接(1)[05-12]
ASP.NET创建Web服务之使用事务[05-12]
Web服务体系结构[05-12]
在线实时开通WEB及FTP源程序[05-12]
WEB打印设置解决方案四[05-12]
架构Web Service: 实战Web服务[05-12]
用ASP+XML打造留言本 - 1[05-12]
XML+JAVASCRIPT+ASP在线短信息功..[05-12]
XML+JAVASCRIPT+ASP在线短信息功..[05-12]
排序方式解决“上下主题”问题(..[05-12]
用VB创建FTP组件(get)[05-12]
用VBScript制作定制的alert弹出消..[05-12]
汉字转化为拼音[05-12]
利用ASP木马程序获取管理权限[05-12]
『VC++技术内幕』学习笔记(2)[05-12]
VB经验谈:限制输入的文本框[05-12]