|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
populate Access Db from ASP arrays
I have 4 asp arrays. I want to populate an Access table with them.
Each array of course has mulitple records. Array1 Array2 Array3 Array4 Array1 (1) should fill in row 1 column 1 of the table Array2 (1) should fill in row 1 column 2 of the table Array1 (2) should fill in row 2 column 1 of the table Array2 (2) should fill in row 2 column 2 of the table etc..... Any help would be appreciated. |
|
#2
|
|||
|
|||
|
Delete your duplicate post.
|
|
#3
|
||||
|
||||
|
alshawver ,
You need to loop through the arrays one by one and update the access table. eg: <% recordset.addnew for a=0 to ubound(Array1)-1 'find out the upper number of the array recordset(0)=Array1[a] 'first column recordset(1)=Array1[a] 'second column next for b=0 to ubound(Array2)-1 'find out the upper number of the array recordset(0)=Array2[b] 'first column recordset(1)=Array2[b] 'second column next '----- like wise loop through the other arrays as well recordset.update 'update your table here %>
__________________
SR - webshiju.com www.lizratechnologies.com "The fear of the LORD is the beginning of knowledge..." |
|
#4
|
|||
|
|||
|
ok I got the recordset to populate. Thanks
I have another problem. I am passing the arrays from a javascript form to this asp page. Currently I am passing the length of the arrays with them from the form. How can I get the length of the arrays without passing it?? I've tried: dim array1() array1 = Request.Form("array1fromform") highArray1 = UBound("array1") lowArray1 = LBound("array1") length = highArray1 - lowArray1 + 1 This gives me a 'type mismatch' error. ---------------------------------------------------------------- Then I tried: dim array1() array1() = Request.Form("array1fromform") highArray1 = UBound("array1") lowArray1 = LBound("array1") length = highArray1 - lowArray1 + 1 This gives me a 'subscript out of range' error. ---------------------------------------------------------------- Then I tried: dim strArray1 dim Array1 strArray1 = Request.Form("array1fromform") Array1 = split(strArray1, ",") 'figuring the form is passing a string highArray1 = UBound("Array1") lowArray1 = LBound("Array1") length = highArray1 - lowArray1 + 1 This also give me a 'type mistmatch' error. Any suggestions?????? |
|
#5
|
||||
|
||||
|
The length of the array you should get using UBound(Array)+1.
eg: UBound(Array1)+1 Try the following and tell me the result: <% dim strArray1 dim Array1 'strArray1 = Request.Form("array1fromform") strArray1="hello,from,shiju" 'test string Array1 = split(strArray1, ",") 'figuring the form is passing a string 'highArray1 = UBound(Array1) 'lowArray1 = LBound(Array1) 'length = highArray1 - lowArray1 + 1 length=UBound(Array1)+1 'total of the above array . response.write(length) //print the length %> |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > populate Access Db from ASP arrays |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|