473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Querystring Values spaces causing errors

I am trying to update my table with a value passed though the
request.queryst ring 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%20 Entertainment' 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


Jul 19 '05 #1
4 2460

Replace (request.querys tring ,"%20", " ")
"JP SIngh" <no**@none.co m> schreef in bericht
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I am trying to update my table with a value passed though the
request.queryst ring 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%20 Entertainment' 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

Jul 19 '05 #2
If you use post instead of get, you can avoid this error.

If you use id numbers instead of long, un-URL-friendly descriptions to
identify rows, you can avoid this error.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"JP SIngh" <no**@none.co m> wrote in message
news:#M******** ******@TK2MSFTN GP12.phx.gbl...
I am trying to update my table with a value passed though the
request.queryst ring 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%20 Entertainment' 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

Jul 19 '05 #3
Classic ASP Design Tips - QueryString
http://www.bullschmidt.com/devtip-querystring.asp

Example URL with a querystring:
http://www.mysite.com/mydir/mypg.asp...=hey&myvar2=ho

Because a variable might contain some odd characters like spaces, it's
usually a good idea to use Server.URLEncod e when creating a querystring
from a variable:
<a href="http://www.mysite.com/mypage?id=<%=
Server.URLEncod e(objRS("MyIDFl dFromDB")) %>">objRS("MyID FldFromDB")</a>

And in the page that is opened you can use Request.QuerySt ring("id") to
get the value of id.

Best regards,
J. Paul Schmidt, Classic ASP Web Designer
http://www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Demo, ASP Bar Chart Tool...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
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%20E ntertainment' is 'Arts and Entertainment' as far as HTML
is concerned. However, the same statement is
'Arts%20%26%20E ntertainment' 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.HTMLEnco de() 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=Art s & 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.queryst ring 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%20 Entertainment' 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


Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1937
by: Fawke101 | last post by:
Hi there, I have a ASP/SQL 7 application that displays data from various SQL7 Views onto a ASP page. A column of this data is displayed in ASP as hyperlinks and the relevent data is put into a URL query string - so that the linked page is based on this data ( a kind of "drill-down" effect) - ***
4
19734
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to appear in the url anymore. How can I get rid of it? A postback doesn't clear it, it just keeps tagging along. I tried Request.QueryString.Clear, but...
6
11999
by: John Grandy | last post by:
Does Server.URLDecode() need to be applied to Request.QueryString(<key name>) ?
3
1987
by: Dariusz Tomon | last post by:
Hi My problem is like that: I'm trying to pass values branza and jezyk in querysting: http://localhost/euroadres/pokazbranza.aspx?branza=transport lotniczy&jezyk=1 Branza is type "string" and when I'm passing string value without national
6
1699
by: duncan.welch | last post by:
Hi, I've got a website that uses links for page positioning which works great about 99% of the time. For some reason, 1% of the time I'll get an error when parsing the querystring, as it's reading the anchor name as part of the number. e.g. http://www.fluidstyle.co.uk/venuedetails.aspx?venueID=1964#review
4
9477
by: | last post by:
Hi all, If I am reading this right, then the querystring parameters must be "&amp;" and not "&". However, IIS 6.0 and asp.net request.querystring fails to capture the values if "&amp;" is specified. e.g. http://myserver/test.aspx?pid=1&amp;did=2 http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2 Any ideas?
5
3573
by: magix8 | last post by:
Hi, I have form GET method, example: index.asp?Type=1&Type=3&Type=4&.... So, I have something like this at the receiver side to retrieve multiple Type value and insert into tables.
9
1930
by: joe | last post by:
Hello, I have a website set up on our server that is especially for errors. When another website encounters an error, it will redirect to this site with error details in the querystring. The error website process the querystring and displays a nicely formatted error message with details. The problem I am having is that the querystrings...
2
3180
by: Arch Stanton | last post by:
I have an aspx page with a text box. My user enters text to search for and presses a button; the text is passed via a QueryString to another aspx page and used in a SQL search. The wildcard character is a percent sign. This works great if I place the % at the end of a search string, but I'm getting peculiar errors if I start the search...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.