asp.net 4.5 练习~test16

编程入门 行业动态 更新时间:2024-10-27 20:38:27

asp.<a href=https://www.elefans.com/category/jswz/34/1770819.html style=net 4.5 练习~test16"/>

asp.net 4.5 练习~test16

服务引用地址:.asmx

或.asmx?wsdl

添加服务引用后,请修改引用名,我设定的是webxml。

 

settings.designer.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.42000
//
//     对此文件的更改可能会导致不正确的行为,并且如果
//     重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------namespace test16_5.Properties {[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()][global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));public static Settings Default {get {return defaultInstance;}}[global::System.Configuration.ApplicationScopedSettingAttribute()][global::System.Diagnostics.DebuggerNonUserCodeAttribute()][global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)][global::System.Configuration.DefaultSettingValueAttribute(".asmx")]public string test16_5_webxml_TrainTimeWebService {get {return ((string)(this["test16_5_webxml_TrainTimeWebService"]));}}}
}

webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test16_5.WebForm1" %><!DOCTYPE html><html xmlns="">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title></title>
</head>
<body><form id="form1" runat="server"><div><h3>火车时刻表查询</h3>起始站:<asp:TextBox ID="txtStart" runat="server"></asp:TextBox>终点站:<asp:TextBox ID="txtEnd" runat="server"></asp:TextBox><asp:Button ID="Button1" runat="server" Text="查询" OnClick="Button1_Click" /><br /><asp:GridView ID="GridView1" runat="server" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black"><FooterStyle BackColor="#CCCCCC" /><HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" /><RowStyle BackColor="White" /><SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" /><SortedAscendingCellStyle BackColor="#F1F1F1" /><SortedAscendingHeaderStyle BackColor="#808080" /><SortedDescendingCellStyle BackColor="#CAC9C9" /><SortedDescendingHeaderStyle BackColor="#383838" /></asp:GridView></div></form>
</body>
</html>

webform1.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;namespace test16_5
{public partial class WebForm1 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){}protected void Button1_Click(object sender, EventArgs e){webxml.TrainTimeWebService service1 = new webxml.TrainTimeWebService();DataSet ds = service1.getStationAndTimeByStationName(txtStart.Text, txtEnd.Text, "");GridView1.DataSource = ds;GridView1.DataBind();service1.Dispose();}}
}

给大家个网址,可以有很多服务的,

.aspx?offset=4

更多推荐

asp.net 4.5 练习~test16

本文发布于:2024-03-04 00:23:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1707768.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:net   asp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!