|
下面的一段代码出现:
"System.InvalidCastException: 指定的转换无效。"
排错提示:
"当一个数字执行强制转换时,值必须是一个小于无限大的数字
确保源类型可以转换为目标类型"
寻求帮助,马上给分,如果解释给大家解释很明白,我愿在加分!!
public IList<Bbs_PostDetailsInfo> GetPostDetails(string postid)
{
IList<Bbs_PostDetailsInfo> postlist = new List<Bbs_PostDetailsInfo>();
strSql = "SELECT * FROM V_Bbs_PostDetails WHERE Post_Id=" + postid;
sdr = GetDataReader(strSql);
while (sdr.Read())
{
postlist.Add(new Bbs_PostDetailsInfo(sdr.GetInt32(0), sdr.GetString(1), sdr.GetString(2), sdr.GetInt32(3),
sdr.GetString(4), sdr.GetString(5), sdr.GetDateTime(6), sdr.GetInt32(7), sdr.GetString(8), sdr.GetDateTime(9),
sdr.GetString(10), sdr.GetString(11), sdr.GetString(12), sdr.GetString(13), sdr.GetString(14), sdr.GetString(15),
sdr.GetInt32(16), sdr.GetInt32(17), sdr.GetInt32(18), sdr.GetInt32(19), sdr.GetInt32(20), sdr.GetInt32(21),
sdr.GetString(22), sdr.GetDateTime(23), sdr.GetInt32(24), sdr.GetInt32(25), sdr.GetString(26), sdr.GetInt32(27), sdr.GetInt32(28), sdr.GetInt32(29)));
}
sdr.Close();
sdr.Dispose();
return postlist;
} |
|