Redim and Preserve in ASP Arrays
-배열 길이 값을 보전하면서 동적변환
-배열 길이 증감
When you're using ASP arrays, sometimes you want to make them larger part way through processing. The Redim command lets you alter an array size - and the preserve command saves the data already there.
Let's say you start out with an array that normally only needs around 5 items in it. So you could do
Dim ShopCart(5)
This would conserve memory space and take into account what most people would use it for. But let's say someone comes along who wants more than 5 items in their shopping cart! You don't want to lose that extra information. So to make the array size larger, you would say
Redim ShopCart(10) //요렇게 하면 기존의 값이 날라감
or whatever new size you wanted to bump it up to. One problem, though. A redim command loses any data currently in the array. This might be fine if you're just getting started, but if someone is halfway through shopping it'd be bad to lose their data. In that case, you would instead use -
Redim PRESERVE ShopCart(10) //요렇게 하면 기존의 값이 보관되고 길이도 변경됨
This keeps the array we had already and just adds more space to it.
'ASP' 카테고리의 다른 글
asp코드에서 오라클 대용량 필드 value를 가져오는 부분입니다 (0) | 2011.07.01 |
---|---|
ASP 요것만 알면됨 (2) | 2010.10.11 |
[IIS7]ASP 에서 자세한 오류표시 (0) | 2010.10.11 |
[SiteGalaxyUpload] .Form.1 오류 '80004005' (0) | 2010.08.20 |
ASP 예외처리/에러코드 보여주기 (0) | 2010.05.10 |
asp 강제 파일다운로드 (0) | 2010.05.10 |
[MSDN]ASP에서 BLOB필드에 저장된 이미지를 나타내는 방법 (0) | 2010.01.03 |
Free Code MD5 사용법 및 암호화파일 (0) | 2009.12.15 |
Tag 삭제 (0) | 2009.12.15 |
오라클 ( LONG TYPE )대용량 필드에 값넣기 (0) | 2009.12.15 |