WCF返回ArrayList时没有数据?

时间:2013-12-09 12:59:01

标签: c# wcf http arraylist

从以下代码接收任何异常,但我也没有收到任何数据,为什么会这样?

我的DataAccess,

public ArrayList get_devices(string CityName, string Date1)
{
    if (con.State == ConnectionState.Closed)
    {
        con.Open();
    }
    ArrayList m = new ArrayList();
    DataSet1TableAdapters.Tb_CityTableAdapter City = new DataSet1TableAdapters.Tb_CityTableAdapter();
    value = City.Select_CityId(CityName);
    SqlCommand cmd = new SqlCommand("SELECT  TB_Destiniation.Dest_Time, TB_Bases.Bases_Num, TB_Company.Company_Name    FROM            TB_Destiniation INNER JOIN TB_Bases ON TB_Destiniation.Bases_Id = TB_Bases.Bases_Id INNER JOIN  TB_Company ON TB_Bases.Company_Id = TB_Company.Company_Id WHERE  City_Id='" + value + "' AND Dest_Date='" + Date1 + "'", con);
    SqlDataReader reader = cmd.ExecuteReader();
    int x = 0;
    while (reader.Read())
    {
        string[] record = new string[2];
        //String Re = Convert.ToString(reader.GetValue(0));
        record[0] = Convert.ToString(reader.GetValue(0));
        record[1] = Convert.ToString(reader.GetValue(2));

        m.Add(record);
        x++;
    }
    return m;
}

这是我的OperationContract,

[OperationContract]

[WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = 

WebMessageFormat.Json, UriTemplate = "Get?CityName={CityName}&Date1={Date1}")]

ArrayList get_devices(string CityName, string Date1);

这些是我的IService1会员,

#region IService1 Members

public ArrayList get_devices(string CityName, string Date1)
{
    DataAccess dataAccess = new DataAccess();
    return dataAccess.get_devices(CityName, Date1);
}

#endregion

0 个答案:

没有答案