bikebanditcom
Programmer
the following post was made to a question of mine, however i can't get the code to work and have yet to hear back from that post, can anyone help me with the final part of this bit of code, what i need is to know how to write the sql statement and declare which fields to insert into in the database.
there are three declared below in the array, partNumber, qty, and dealer, all of those go into tblPartInfo, and all go into fields of the same name. anyone have any clue as to how to do this? here is his post
"The way you're form data and table are mean that you'll need the 2-dimensional array....
dim fieldArr()
redim fieldArr(9,0) 'assuming 10 total fields for each record'
'if you have fields that do not fit the name_## format, you may need to alter this to handle them'
for each item in request.form
underscorePos = inStr(item, "_"
recordNum = mid(request.form(item), underscorePos + 1)
if recordNum > uBound(fieldArr,2) then
redim preserve(fieldArr(9,cInt(recNum)))
end if
select case left(item,underscorePos - 1)
case "partNumber"
arrPos = 0
case "qty"
arrPos = 1
case "dealer"
arrPos = 2
'complete for all items
end select
fieldArr(arrPos, cInt(recNum)) = request.form(item)
next
'now just write you sql for each record'
for x = 1 to uBound(fieldArr,2)
sql = "INSERT myTable VALUES("&_
"'" & fieldArr(0,x) & "'," &_
"'" & fieldArr(1,x) & "'," &_
"'" & fieldArr(2,x) & "'," &_
'continue for all records and add a closing "
"
cn.execute (sql)
next "
there are three declared below in the array, partNumber, qty, and dealer, all of those go into tblPartInfo, and all go into fields of the same name. anyone have any clue as to how to do this? here is his post
"The way you're form data and table are mean that you'll need the 2-dimensional array....
dim fieldArr()
redim fieldArr(9,0) 'assuming 10 total fields for each record'
'if you have fields that do not fit the name_## format, you may need to alter this to handle them'
for each item in request.form
underscorePos = inStr(item, "_"
recordNum = mid(request.form(item), underscorePos + 1)
if recordNum > uBound(fieldArr,2) then
redim preserve(fieldArr(9,cInt(recNum)))
end if
select case left(item,underscorePos - 1)
case "partNumber"
arrPos = 0
case "qty"
arrPos = 1
case "dealer"
arrPos = 2
'complete for all items
end select
fieldArr(arrPos, cInt(recNum)) = request.form(item)
next
'now just write you sql for each record'
for x = 1 to uBound(fieldArr,2)
sql = "INSERT myTable VALUES("&_
"'" & fieldArr(0,x) & "'," &_
"'" & fieldArr(1,x) & "'," &_
"'" & fieldArr(2,x) & "'," &_
'continue for all records and add a closing "
cn.execute (sql)
next "