Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Injecting form value into query

$
0
0

Hello, and happy new year!

New on this forum and also a little bit rusted, so please be kind! ;)

Can someone please help me figure out how to pass this form input value to the access query?

<%

form_ID = request("ID")


'if i hardcode the ID, the page loads properly

query = "SELECT * FROM MYTABLE WHERE ID = 2"



'however, when I try to use the value coming from a form, I get a 500 for anything rnaginh form syntax, to data type. 

query = "SELECT * FROM MODEL_TIMESHEETS WHERE ID = '"& (request("ID")) &"'"


'rest of script

Set db = Server.CreateObject("ADODB.Connection")
db.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database/INVOICING_DATA.mdb") & ";UID=;PWD="

set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.CursorLocation = aduseclient
objRS.CursorType = adOpenStatic
objRS.LockType = adLockReadOnly
objRS.Open query,db, , , adcmdtext

%>

I was pretty sure this was a correct approach, and see it workign in other files but as I said, Im a little rusty, 

Any help or guidance is appreciated!

A.


Viewing all articles
Browse latest Browse all 488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>