Connecting Tech Pros Worldwide Forums | Help | Site Map

asp quotes reading from database

Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#1: Mar 1 '09
Hi, I have a size field where the input is in quotes like 20" x 20"
It writes to the database as I see the correct output in the webpage but when I open the record to update it it removes the quotes and I just get the first digets.
I have tried
Expand|Select|Wrap|Line Numbers
  1. imagesize= Replace(imagesize, "'", "''")
but that only replaces ' with "
I have looked around but cannot see the right solution. If anyone has the answer that would be great. Might it be that the access database field at the moment is set to text and amybe it should be memo or number?
Richard

jenkinsloveschicken's Avatar
Member
 
Join Date: Dec 2006
Posts: 56
#2: Mar 1 '09

re: asp quotes reading from database


If you field types were set to number, your insert and updates would fail on datatypes. Text/Memo should work here(be a while since I worked with Jet).

Can you show us what a field value in the database looks like? If you are able to store 20"x20" in the field, then this should just be a matter of correctly using the replace function.

And can you define for us what you mean by opening the record to update it? Are you going directly into the table via Access, or querying a recordset and updating the record via the recordset?


Regards,
Jenkins
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#3: Mar 1 '09

re: asp quotes reading from database


Thanks for replying Jenkins,
I have memo in the database and I have opened my database to check that it writes the "" to it and it does, Its when I view through a recordset (a control panel) the "" get removed. Trouble is as they dont show in the form field when I update they get overwritten by the data without them.
I have this where I view the database contents

Expand|Select|Wrap|Line Numbers
  1. 'set database connection
  2. Set conn=Server.CreateObject("ADODB.Connection") 
  3. conn.Mode = 3      '3 = adModeReadWrite
  4. conn.Open ConnectString
  5.  
  6. Set rsCat=conn.Execute("Select categoryName,CategoryID From tblCategories Order By categoryName ASC")
  7. strTask="Insert"
  8. lngCategoryID=0
  9.  
  10.  
  11. If Request("artistID") <> ""  Then
  12.     strSQL="Select * From tblartists Where artistID=" & Clng(Request("artistID"))
  13.     Set rsart=conn.Execute(strSQL)
  14.     lngCategoryID=rsart("CategoryID")
  15.     imagetitle=rsart("imagetitle")
  16.     imagemedium=rsart("imagemedium")
  17.     imageprice=rsart("imageprice")
  18.     imagesize=rsart("imagesize")
  19.     imageyear=rsart("imageyear")
  20.     pictureurl=rsart("pictureurl")
  21.     additional=rsart("additional")
  22.     pay=rsart("pay")
  23.     pagetitle=rsart("pagetitle")
  24.     pagedescription=rsart("pagedescription")
  25.  
  26.  
  27. Set rsart=Nothing
  28. strTask="Update"
  29. Else
  30.  
  31. End If 
whatever I put in the field works fine its just the "text" that dont work.

20"x20" gives me 20
20x20" gives me 20x20
its obviously cutting the text from the last "
It seems to be a common problem. In my case its just a question of getting to see the "" in my select query.
If you have any ideas thanks
Richard
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#4: Mar 1 '09

re: asp quotes reading from database


Hi, I actually found the problem was not to do with the asp but the form field. I changed the field to a text area from a input type="text" and it worked. I am not sure if there is a problem with text areas and the ", but it seems to work now.
Thanks
Richard
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#5: Mar 2 '09

re: asp quotes reading from database


Quote:

Originally Posted by fran7 View Post

Hi, I actually found the problem was not to do with the asp but the form field. I changed the field to a text area from a input type="text" and it worked. I am not sure if there is a problem with text areas and the ", but it seems to work now.
Thanks
Richard

That's what I was going to suggest. You can display quote marks just fine in a text area, but to do the same in a text input you would need to convert it to [ampersand]#34; or [ampersand]quot;

Jared
Reply


Similar ASP / Active Server Pages bytes