传参数中数据类型转换的错误!
public IList<ImageMachineInfo> GetImageMachine(ImageMachineInfo type){
SqlHelper objSqlHelper = new SqlHelper();
List<ImageMachineInfo> imageMachines = new List<ImageMachineInfo>();
SqlParameter[] objParams = new SqlParameter[1];
objParams[0] = new SqlParameter("@type", SqlDbType.Int, 4);
objParams[0].Value = (int)type;
SqlDataReader reader = objSqlHelper.ExecuteReader("Game_IB_GetImageBook", objParams);
while (reader.Read())
{
ImageMachineInfo item = GetImageMachineByID(reader.GetInt32(reader.GetOrdinal("imageID")));
imageMachines.Add(item);
}
reader.Close();
return imageMachines; ;
}
以上代码中此句objParams[0].Value = (int)type;报告错误!
错误内容:无法将类型"Game.components.Model.ImageMachineInfo"转换为"int"
请问如何解决这么的错误??????? --------------------编程问答-------------------- 用convert类试试 --------------------编程问答-------------------- 都提示你不能转换了 --------------------编程问答-------------------- type 里面是什么东西,是int数据不,是只能强制转
补充:.NET技术 , C#