
September 9th, 2011, 11:48 AM
|
|
Registered User
|
|
Join Date: Sep 2011
Posts: 2
Time spent in forums: 33 sec
Reputation Power: 0
|
|
|
Database fields to reference Arrays in ASP
As a relative beginner to ASP, please do not scream NEWBIE too loudly when reading/answering...
I have an ASP page that displays items for a user to choose by clicking a radio button to select. Rather than manually build each item's display I have stored all the attributes of the item in an Access database and build the display dynamically.
Since I need to reference the items later I load the attributes into arrays like this:
itemrow = 0
Do While Not recordset.EOF
itemradio(itemrow) = Recordset("radname")
itemdesc(itemrow) = Recordset("Item")
itemcost(itemrow) = Recordset("itemcost")
itemvalue(itemrow) = Recordset("itemvalue")
itemimage(itemrow) = Recordset("Image")
itemrow = itemrow + 1
Recordset.MoveNext
Loop
Recordset.Close
Connection.Close
In the database radname would contain values like:
0
1
2
3
4
etc
When the form is submitted, I grab the value and store it in a field.
function get_radio_value()
{
for (var i=0; i < document.form1.group1.length; i++)
{
if (document.form1.group1[i].checked)
{
var rad_val = document.form1.group1[i].value;
document.form1.chose.value = rad_val;
return true;
}
}
}
Here is where I have issues. I am sure it is something I am doing or perhaps the type of field in the database that is causing it, but when I attempt to reference the information using the code below I constantly get a Type Mismatch no matter what type of field I set it to in the Access database.
varchose = Request.form("chose")
response.write(itemradio(varchose))
Is there some type of conversion I need to do? I have tried setting the database field to text length 2, long, integer etc.
ANY help would be so greatly appreciated!!
Thanks in advance!
|