作者: 乔克斯
查看: 7515|回复: 15

主题标签Tag

打印 上一主题 下一主题

[源码] 【快递查询】100快递查询

[复制链接]
跳转到指定楼层
楼主
查看: 7515|回复: 15
100快递查询

  本示例是.NET获取快递100提供的查询快递信息的方法的一个案例。

效果截图:




窗体调用代码:

[C#] 纯文本查看 复制代码
public partial class kuaidi : Form
    {
        public kuaidi()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string fileName = "Database.xml";
            DataSet xmlread = new DataSet();
            xmlread.ReadXml(fileName);
            cbKuaidi.DataSource = xmlread.Tables[0];
            cbKuaidi.ValueMember = "key";
            cbKuaidi.DisplayMember = "com";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            txtResult.Text = "";
            string com=cbKuaidi.SelectedValue.ToString();
            string sn=txtSN.Text;
            string json = HttpRequstCommand.HttpGet("http://www.kuaidi100.com/query", "type=" + com + "&postid=" + sn);
            Dictionary<string,object> ht = JsonCommon.SelectDictionary(json);
            if (ht["status"].ToString() == "200")
            {
                ArrayList aList = new ArrayList();
                aList = (ArrayList)ht["data"];
                for (int i = 0; i < aList.Count; i++)
                {
                    Dictionary<string, object> di = (Dictionary<string, object>)aList[i];
                    txtResult.Text += "处理时间:" + di["time"] + "|" + di["context"]+"\r\n";
                }
            }
            else
            {
                txtResult.Text = "快递或单号错误";
            }

        }
    }


源码案例下载:


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏7 转播转播
回复 论坛版权

使用道具 举报

16#
finewonder 发表于 2019-2-11 15:35:16 | 只看该作者
谢谢分享
回复

使用道具 举报

15#
qingyuan 发表于 2018-5-22 13:34:27 | 只看该作者
666666666555555555555
14#
King8 发表于 2016-3-31 17:06:13 | 只看该作者
谢谢分享~~~~~~~~
回复

使用道具 举报

13#
suncathay 发表于 2016-3-22 08:39:40 | 只看该作者
现在好像不行了
12#
扒她衣服上她床 发表于 2016-3-21 13:25:20 | 只看该作者
支持主楼 看看 下载
11#
jjzxc99 发表于 2016-2-21 01:47:53 | 只看该作者
66666马克
回复

使用道具 举报

10#
liqud 发表于 2016-2-19 15:26:24 | 只看该作者
这个拿来学习一下呢
9#
风雷之冰 发表于 2015-8-24 10:21:30 | 只看该作者
学习了
回复

使用道具 举报

8#
风雷之冰 发表于 2015-8-24 10:21:07 | 只看该作者
#在这里快速回复#学习了
您需要登录后才可以回帖 登录 | 加入CSkin博客

本版积分规则

QQ|申请友链|小黑屋|手机版|Archiver|CSkin ( 粤ICP备13070794号

Powered by Discuz! X3.2  © 2001-2013 Comsenz Inc.  Designed by ARTERY.cn
GMT+8, 2024-5-2 14:03, Processed in 0.581594 second(s), 37 queries , Gzip On.

快速回复 返回顶部 返回列表