|
Aha! Three days in the relevant link exchange forum!
If he wasn't passing the id variable it would return a blank string, and send the query select * from attorneys where id='' to the database. That could provoke an error for implicit conversions if id is a numeric field, because you can't turn an empty string into a number, but if it's against an Access database, the "required parameters" error means something that looks like a field from SQL syntax hasn't been assigned a value.
Basically, the field is probably AttorneyID and not ID; if the field id doesn't exist in the query, Access assumes it's a parameter, and if you try to run the query in Access, it will give you an InputBox asking you to supply a value for id. Then it would run a query like Select * from attorneys where [value you typed]='' and not return any results. Unless you just hit enter, and it would return all rows.
But Response.Write is the magic debug injecter in asp. And if you have some dynamically generated SQL, the best way to debug is to see exactly what query is being generated, and test it in the database directly.
An even better idea, though, is that dynamic SQL must die.
|