避免Object cannot be cast from DBNull to other types. 错误

if(sRows[0]["Cycle"].GetType() != Type.GetType("System.DBNull"))//check if DBNull
                            outCycle = Convert.ToInt32(sRows[0]["Cycle"]);
posted @ 2007-04-19 12:08  Ready!  阅读(3481)  评论(3编辑  收藏  举报