Values of location field gets truncated in a asp generated table

J

Jack

THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE

<%
sql01 = "SELECT COUNT(*) AS reccount FROM Equipmenttbl "
sql01 = sql01 & "WHERE Equipmenttbl.GrantID = " & GrantID

'Response.Write sql01 & "<br>"
'Response.End

i = 0
sql01 = "SELECT equipmentTbl.* FROM EquipmentTbl "
sql01 = sql01 & "WHERE EquipmentTbl.GrantID = " & GrantID
response.write "SELECT SQL:" & sql01
'response.end
rstemp.open sql01
'set rstemp=conntemp.execute(sql01)
Do until rstemp.eof
i = i + 1
response.write "<TR>" & vbCRLF
strLink = "<TD WIDTH=1% ><INPUT TYPE='HIDDEN' NAME='EquipmentID_" & i &
"' VALUE=" & rstemp("EquipmentID") & "></TD>" & vbCRLF
response.write strLink & vbCRLF
if session("locked")<>"Y" then
strLink = "<TD WIDTH=1% ><A TITLE='Click here to delete line'
HREF='ConfirmDeleteEquipmentLine.asp?EquipmentID=" & rstemp("EquipmentID") &
"'>Delete</A></TD>" & vbCRLF
response.write strLink & vbCRLF
else
strLink = "<TD WIDTH=1% ></A></TD>" & vbCRLF
response.write strLink & vbCRLF
end if
strLink = "<TD WIDTH=10% ALIGN=LEFT><INPUT TYPE='text' SIZE=10
NAME='serialnum_"& i & "' VALUE='" & rstemp("SerialNumber") & "'></TD>" &
vbCRLF
response.write strLink & vbCRLF

strLink = "<TD WIDTH=40% ALIGN=LEFT><INPUT TYPE='text' SIZE=45
NAME='Desc_"& i & "' VALUE='" & rstemp("Description") & "'></TD>" & vbCRLF
response.write strLink & vbCRLF

strLink = "<TD WIDTH=10% ALIGN=LEFT><INPUT TYPE='text' SIZE=28
NAME='Location_" & i & "' VALUE='" & rstemp("Location") & "'></TD>" & vbCRLF
response.write strLink & vbCRLF


response.write rstemp("Location") & "<br>"

strLink = "<TD WIDTH=10% ALIGN=RIGHT><INPUT TYPE='text' SIZE=12
NAME='Cost_" & i & "' VALUE='" & rstemp("Cost") & "' style='text-align:
right;'></TD>" & vbCRLF
response.write strLink & vbCRLF

strLink = "<TD WIDTH=20% ALIGN=CENTER><INPUT TYPE='text' SIZE=1
NAME='Expmonth_" & i & "'VALUE='" & month(rstemp("DateAcquired")) & "'>/
<INPUT TYPE='text' SIZE=1 NAME='ExpDay_" & i & "'VALUE='" &
day(rstemp("DateAcquired")) & "'>/ <INPUT TYPE='text' SIZE=2 NAME='Expyear_"
& i & "'VALUE='" & year(rstemp("DateAcquired")) & "'></TD>" & vbCRLF
'***************
response.write strLink & vbCRLF

response.write "</TR>" & vbCRLF

totalcost=totalcost+rstemp("Cost")
'save the check box value and Financial Officers name. Should be the
same on
'all records as it will get updated each time the UPDATE button is
clicked.
'Check box and name are redundant but this is the way it was originally
set up
'Decided to go with the flow rather than trying to save these values in
the
'GrantTBL so they are not redundant.
ICertify = rstemp("ICertify")
FinancialOfficer = rstemp("FinancialOfficer")
rstemp.movenext
loop
rstemp.close
%>
</TR>


In the above code which is a input screen (as well as display screen) all
the equipment rows of a particular GrantId is captured
from the above recordset and is displayed in a table format by the above
loop. The problem is that for the values
of location for various rows, if there is a single quote in the row, then
only part of the value is captured in the
location column of this generated table.

I have added a response.write rstemp("Location") & "<br>" statement to see
the values that are retrieved
from the backend table corresponding to the locaion field.In the present
scenario the following was the result i.e. here we can see that the single
quotes
are retrieved as is. The results are the following:

Conference Room's Cabinet
Server Rooom
Don's Room
Server Room

However, in the asp generated table for the location column the values are
as follows:
Conference Room
Server Rooom
Don
Server Room

Thus all character including and after the single quote(') is getting
truncated.

I have no idea why this truncation is happening when the rows are being
dynamically formed in the asp table
but retrieves the whole value by issusing a response.write statement. And
what is the resolution for this problem so
that the location field in the generated asp table shows data without any
truncation.

Any help is appreciated.

Thanks in advance.
 
A

Avlan

This has something to do with the fact that SQL-statements use the
'-character. I think the solution was something with putting the ' in
between two ", so it will be something like "'" (or " ' " with spaces).

When a '-character is used, you effectively tell the server the
SQL-string ends there.

I'm probably a bit vague but thats because its been some time since I
had sort of the same problem ;-)
 
J

Jack

Thanks for your help Alvan. I appreciate it. However, it did not help me
resolve this problem. Hence I had to post this message again to see if
someone has some suggestion fo resolution of this problem.
 
P

Paxton

Avlan said:
This has something to do with the fact that SQL-statements use the
'-character. I think the solution was something with putting the ' in
between two ", so it will be something like "'" (or " ' " with spaces).

When a '-character is used, you effectively tell the server the
SQL-string ends there.

I'm probably a bit vague but thats because its been some time since I
had sort of the same problem ;-)

No - it's HTML 101.

The OP was using a single quote to delimit his attribute values. This
is OK if they contain double quotes, but when the browser reaches the
single quote in the value, it figures it has reached the end of the
value, so stops writing.

HTML specification is that you use doublequotes for attribute values.
In XHTML, it's mandatory.

/P.
 
P

Paxton

Paxton said:
No - it's HTML 101.

The OP was using a single quote to delimit his attribute values. This
is OK if they contain double quotes, but when the browser reaches the
single quote in the value, it figures it has reached the end of the
value, so stops writing.

HTML specification is that you use doublequotes for attribute values.
In XHTML, it's mandatory.

/P.

Oops. Meant to say HTML *recommendation*, not specification.

/P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top