代码改变世界

Web Service返回符合Xml Schema规范的Xml文档

2014-01-22 15:03  池戎  阅读(233)  评论(0编辑  收藏  举报

[WebMethod(Description = "根据输入的RoadID号来返回符合Xml Schema规范的Xml文档")] //返回符合Xml Schema规范的Xml文档
    public DataSet ByRoadID(decimal RoadID)
    {
        SqlConnection conn = new SqlConnection("server=AEROMATEX-CR\\SQLEXPRESS;database=temp;min pool size=40;User ID=sa;Password=sa");
        DataSet dsReturn = new DataSet();
        conn.Open();
        SqlCommand cmd = new SqlCommand("select * from [Traffic] where RoadID = @CrRoadID", conn);
        SqlParameter param = new SqlParameter();
        param.ParameterName = "@CrRoadID";
        param.Value = RoadID;
        cmd.Parameters.Add(param);
        SqlDataAdapter adpt = new SqlDataAdapter(cmd);
        adpt.Fill(dsReturn, "Traffic");
        conn.Close();
        return dsReturn;
    }

也许某年某月的某一天可能用到,但是这是哪一天捏?
到时候也许我自己都看不懂这没注释的代码了。