The error message is indicating that the database is designed in such a
way that a matching record must exist in the 'Departments' table.
Basically, you're trying to add a record to a table that has a specified
relationship to the 'Departments' table. The problem is not neccessarily
related to the querystring values, however it might be.
Double check that there is a record in the 'Departments' table for 'Arts
& Entertainment'. If a record doest exist, then the problem has to do
with the fact that the special characters are encoded.
'Arts%20%26%20Entertainment' is 'Arts and Entertainment' as far as HTML
is concerned. However, the same statement is
'Arts%20%26%20Entertainment' when it comes to the database. The DB is
seeing the string literally as it appears. So what you need to do is to
convert the encoded characters back to their text versions. I've never
dealt with this particular problem. Server.HTMLEncode() can be used to
encoded the characters initially, however I'm not familar with a means
to unencode them.
You shouldn't have to encode the string to begin with though.
?department=Arts & Entertainment
should work without any problems.*
David H
*In the event that this doesn't work and causes catastrophic results
including but not limited to the destruction of mankind, you're on your
own.
Secon
JP SIngh wrote:
I am trying to update my table with a value passed though the
request.querystring method but as you can see from the sql statement below
it is causing errors.
In this case the name of the department as displayed is "Arts and
Entertainment" but it is giving me something strange when I try to use the
variable
update empprofile set department ='Arts%20%26%20Entertainment' where
employeenumber =219104
Microsoft JET Database Engine error '80004005'
You cannot add or change a record because a related record is required in
table 'Departments'.
/admin/updatedept.asp, line 32
Any solutions
Regards
Jas