数组和ArrayList 相互转换
Dim params(10) As DbParameter
params(0) = DBHelper.CreateDbParameter("@RegName", Jz_RegInfo.RegName)
params(1) = DBHelper.CreateDbParameter("@RegAddress", Jz_RegInfo.RegAddress)
params(2) = DBHelper.CreateDbParameter("@RegCode", Jz_RegInfo.RegCode)
params(3) = DBHelper.CreateDbParameter("@CutOFFDate", Jz_RegInfo.CutOFFDate)
params(4) = DBHelper.CreateDbParameter("@IsZhengShi", Jz_RegInfo.IsZhengShi)
params(5) = DBHelper.CreateDbParameter("@RegDateTime", Jz_RegInfo.RegDateTime)
params(6) = DBHelper.CreateDbParameter("@ClientID", Jz_RegInfo.ClientID)
params(7) = DBHelper.CreateDbParameter("@Xian", Jz_RegInfo.Xian)
params(8) = DBHelper.CreateDbParameter("@Shi", Jz_RegInfo.Shi)
params(9) = DBHelper.CreateDbParameter("@IsDeleted", Jz_RegInfo.IsDeleted)
params(10) = DBHelper.CreateDbParameter("@Remark", Jz_RegInfo.Remark)
Dim arrayPara As New ArrayList()
arrayPara.AddRange(params)
ArrayList 转换为数组的方法:
数组 as 类型() =ArrayList.ToArray (GetType(类型))
Dim arr As DbParameter() = arrayPara.ToArray(GetType(DbParameter))
Dim Array As DbParameter() = DirectCast(arrayPara.ToArray(GetType(DbParameter)), DbParameter())