Im new to all this and need some help.
I can get this to work (code below) if all my form's fields are textboxes. But when I have listboxes,checkboxes, and/or radio buttons, it does not work.
In my access database, I leave all field value types as "text" except for the fields where I plan to store checkbox values. These fields I put as "ON/OFF"
Is this right? Is this where my problem is?
Maybe my problem is the value I pass my Request.Form statement. For radio buttons I pass the 'name' attribute of the radio button grouping. And I'm assuming that the 'value' it passes is the value of the radio button selected.
Maybe this is where my problem is?
Please show me how to store listbox, radiobutton, and checkbox values into my database.
Thanks
HERE IS MY CODE
Set conn = Server.CreateObject("ADODB.Connection"
conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\blah\db\myDB.mdb"
)
sql="INSERT INTO myTable(field1,field2,field3)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("field1"
& "',"
sql=sql & "'" & Request.Form("field2"
& "',"
sql=sql & "'" & Request.Form("field3"
& "')"
conn.Execute sql,recaffected
if err<>0 then
Response.Write("Failed"
else
Response.Write("Worked"
end if
conn.close
PS - do I need "conn = Nothing" or something like that?
I can get this to work (code below) if all my form's fields are textboxes. But when I have listboxes,checkboxes, and/or radio buttons, it does not work.
In my access database, I leave all field value types as "text" except for the fields where I plan to store checkbox values. These fields I put as "ON/OFF"
Is this right? Is this where my problem is?
Maybe my problem is the value I pass my Request.Form statement. For radio buttons I pass the 'name' attribute of the radio button grouping. And I'm assuming that the 'value' it passes is the value of the radio button selected.
Maybe this is where my problem is?
Please show me how to store listbox, radiobutton, and checkbox values into my database.
Thanks
HERE IS MY CODE
Set conn = Server.CreateObject("ADODB.Connection"
conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\blah\db\myDB.mdb"
sql="INSERT INTO myTable(field1,field2,field3)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("field1"
sql=sql & "'" & Request.Form("field2"
sql=sql & "'" & Request.Form("field3"
conn.Execute sql,recaffected
if err<>0 then
Response.Write("Failed"
else
Response.Write("Worked"
end if
conn.close
PS - do I need "conn = Nothing" or something like that?