C# RDLC报告未加载数据
我已经开发了一个asp.net应用程序,它应该显示我正在通过调用web服务从数据库加载的RDLC报告。该web服务很好,但RDLC没有加载数据。它显示空白的RDLC,而不是显示数据库数据经度、纬度 代码: 网络服务:C# RDLC报告未加载数据,c#,asp.net,c#-4.0,reportviewer,rdlc,C#,Asp.net,C# 4.0,Reportviewer,Rdlc,我已经开发了一个asp.net应用程序,它应该显示我正在通过调用web服务从数据库加载的RDLC报告。该web服务很好,但RDLC没有加载数据。它显示空白的RDLC,而不是显示数据库数据经度、纬度 代码: 网络服务: public List<Coordinates> FetchCoordinates(String FetchParam) { List<Coordinates> Coords = new List<Coordinates>();
public List<Coordinates> FetchCoordinates(String FetchParam)
{
List<Coordinates> Coords = new List<Coordinates>();
Coordinates c;
if(String.IsNullOrEmpty(FetchParam))
{
c = new Coordinates()
{
Error = "No Input Provided"
};
Coords.Add(c);
return Coords;
}
String[] parts = FetchParam.Split(',');
sqlCom.CommandText = "FetchCoordinates";
sqlCom.CommandType = CommandType.StoredProcedure;
String IMEI = parts[0].ToString();
DateTime DateTimeFrom = Convert.ToDateTime(parts[1]);
DateTime DateTimeTo = Convert.ToDateTime(parts[2]);
sqlCom.Parameters.Add("@IMEI", SqlDbType.VarChar).Value = IMEI;
sqlCom.Parameters.Add("@DateTimeFrom", SqlDbType.DateTime).Value = DateTimeFrom.AddSeconds(-DateTimeFrom.Second);
sqlCom.Parameters.Add("@DateTimeTo", SqlDbType.DateTime).Value = DateTimeTo.AddSeconds(-DateTimeTo.Second);
SqlParameter sqlParam = new SqlParameter("@result", SqlDbType.Int);
sqlCom.Parameters.Add(sqlParam);
sqlCom.Parameters["@result"].Direction = ParameterDirection.Output;
try
{
sqlCon.Open();
using (SqlDataReader reader = sqlCom.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
c = new Coordinates()
{
Longitude = reader["Longitude"].ToString(),
Latitude = reader["Latitude"].ToString(),
// Error = "Times:"+"Original="+DateTimeFrom+"<br/>"+"Trimmed Time"+DateTimeFrom.AddSeconds(-DateTimeFrom.Second)
};
Coords.Add(c);
}
return Coords;
}
else
{
c = new Coordinates()
{
Error = "No Data Found for Given Input. Could be Server Error or Try Changing IMEI or DateTime Format"
};
Coords.Add(c);
return Coords;
}
}
}
catch (Exception)
{
c = new Coordinates()
{
Error = "Something Went Wrong"
};
Coords.Add(c);
return Coords;
}
finally
{
sqlCon.Close();
}
}
我也有同样的问题,我的报告中有一些行对象,被删除了,它显示了添加这个。ReportViewer1.RefreshReport;添加数据源之后。确认数据源是否包含记录。错误:错误1事件“Microsoft.Reporting.WebForms.ReportViewer.ReportRefresh”只能出现在+=或-=数据源正在返回列表的左侧,是列表由包含31条记录的两列填写,但rdlc未显示,为什么?ReportViewer1.LocalReport.Referesh而不是RefreshReport;Hassansar不工作
public List<Coordinates> FetchCoordinates(String FetchParam)
{
List<Coordinates> Coords = new List<Coordinates>();
Coordinates c;
if(String.IsNullOrEmpty(FetchParam))
{
c = new Coordinates()
{
Error = "No Input Provided"
};
Coords.Add(c);
return Coords;
}
String[] parts = FetchParam.Split(',');
sqlCom.CommandText = "FetchCoordinates";
sqlCom.CommandType = CommandType.StoredProcedure;
String IMEI = parts[0].ToString();
DateTime DateTimeFrom = Convert.ToDateTime(parts[1]);
DateTime DateTimeTo = Convert.ToDateTime(parts[2]);
sqlCom.Parameters.Add("@IMEI", SqlDbType.VarChar).Value = IMEI;
sqlCom.Parameters.Add("@DateTimeFrom", SqlDbType.DateTime).Value = DateTimeFrom.AddSeconds(-DateTimeFrom.Second);
sqlCom.Parameters.Add("@DateTimeTo", SqlDbType.DateTime).Value = DateTimeTo.AddSeconds(-DateTimeTo.Second);
SqlParameter sqlParam = new SqlParameter("@result", SqlDbType.Int);
sqlCom.Parameters.Add(sqlParam);
sqlCom.Parameters["@result"].Direction = ParameterDirection.Output;
try
{
sqlCon.Open();
using (SqlDataReader reader = sqlCom.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
c = new Coordinates()
{
Longitude = reader["Longitude"].ToString(),
Latitude = reader["Latitude"].ToString(),
// Error = "Times:"+"Original="+DateTimeFrom+"<br/>"+"Trimmed Time"+DateTimeFrom.AddSeconds(-DateTimeFrom.Second)
};
Coords.Add(c);
}
return Coords;
}
else
{
c = new Coordinates()
{
Error = "No Data Found for Given Input. Could be Server Error or Try Changing IMEI or DateTime Format"
};
Coords.Add(c);
return Coords;
}
}
}
catch (Exception)
{
c = new Coordinates()
{
Error = "Something Went Wrong"
};
Coords.Add(c);
return Coords;
}
finally
{
sqlCon.Close();
}
}