Hi, On my website, i have the following select: <select id="MachineType" name="MachineType" > <% If Session("Lan") = "N" Then sqlSup = "SELECT * FROM TMACHINETYPES" Else sqlSup = "SELECT * FROM TMACHINETYPES" End If rsSup.Open sqlSup, DatabaseConnection,adOpenKeyset,adLockOptimistic If rsSup.EOF <> true Then Do until rsSup.EOF %> <option VALUE="<%=rsSup("TM_MACH_N")%>"><%=rsSup("TM_MACH_N")%></option><% rsSup.MoveNext Loop rsSup.Close Set rsSup = nothing Else %><option SELECTED VALUE><%=sTaskNoMachineTYpe%></option><% End If %> </select> Code (markup): So, it's beïng filled up with data from my database. The <select> is a part of a form, that's beïng submitted and saved into the database in another .asp page (so on submit, the website goes to the page 'Update.asp' to save the form into the database. Here's where I encounter the problem: ... 'retrieve data from the select' neTaskMachineType = Request.Form ("MachineType") ... 'save the machinetype into the database rsRe("TR_MACHINETYPE") = neTaskMachineType.Text Code (markup): Saving the text from the <input type="text"...> is no problem, I only encounter the problem on my <select> parts of the form. This is the error: Microsoft VBScript runtime error '800a01a8' Object required: 'Grasmaaier ' Code (markup): The 'Grasmaaier' is the selected value from the dropdown, so somehow it receives the data, but can't save it into the database. I already tried Cstr(), make another variable, Request.Form.Item (, etc, but nothing seems to work. Can someone enlighten me? Thank you!
the problem isn't in <select> item. the problem is in your sql syntax. i think you wrote char value as int value. your sql is: sql="UPDATE TABLE SET TABLE_NAME="&Request.form("MachineType")&" " the right syntax below: sql="UPDATE TABLE SET TABLE_NAME='"&Request.form("MachineType")&"' " use single inverted single commas as ' (i dont know what the word of it )
Thanks for answering. I don't use SQL syntax. I open the table as a dataset, and replace the items via this: rsRe("TR_MACHINETYPE") = neTaskMachineType.Text Code (markup): and then perform a rsRe.Update. I'm doing exactly the same with my <input type="text" ...> items, but they don't give an error (the error is exactly at the point where I'm trying to fill the column TR_MACHINETYPE of my dataset rsRe, not on the specific rsRe.Update
rsRe("TR_MACHINETYPE") = neTaskMachineType.Text this is incorrect. ADORecordset.Values collection is Read-Only. so you can not assign any value.