Hi Bob,
Here is the code for a small prototype where the replace concept is not
workiing.
Hope you would be able to catch the flaw. Since I got my problem resolved by
the alternative method, this is not a stumbling block to me. However, it
would be nice to know where the problem is with regards to trucation even
after using the replace approach. Regards.
Please note that I created a access table and populated it and then wrtoe a
small asp page to test the replace concept.
CREATE TABLE TEST1
(ID COUNTER,
NAME TEXT(50),
STORAGESPACEASSIGNED TEXT(50)
)
INSERT INTO test1 ( Name, StorageSpaceAssigned )
VALUES ("John Doe", "Kitchen Cabinet");
INSERT INTO test1 ( Name, StorageSpaceAssigned )
VALUES ("Jane Doe", "Apartment's Attic");
INSERT INTO test1 ( Name, StorageSpaceAssigned )
VALUES ("Sam Hugh", "Bedroom Cabinet");
INSERT INTO test1 ( Name, StorageSpaceAssigned )
VALUES ("Tom Jones", "Dining Room's Closet");
INSERT INTO test1 ( Name, StorageSpaceAssigned )
VALUES ("Erica James", "None");
ASP CODE TO TEST THAT TRUNCATION IS NOT HAPPENING WHEN WE USE THE REPLACE
METHOD
<% 'The following is code for connecting to the database
myDSN="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\test.mdb"
set CN=server.createobject("ADODB.Connection")
set rs=server.createobject("ADODB.Recordset")
set rstemp=server.createobject("ADODB.Recordset")
CN.Open myDSN
rstemp.ActiveConnection = CN
rs.ActiveConnection = CN
%>
<%
i = 0
sql01 = "SELECT * from tblTest "
rstemp.open sql01
Response.Write "<TABLE BORDER=1>"
Do while not rstemp.EOF
Response.Write "<TR><TD>" & rstemp("Name") & " </TD>"
Response.Write "<TD>" & rstemp("StorageSpaceAssigned") &
" </TD></TR>"
rstemp.MoveNext
Loop
Response.Write "</TABLE>"
rstemp.Close
'Response.End
rstemp.Open sql01
Do until rstemp.eof
i = i + 1
Response.Write "<TABLE>" & vbcrLf
response.write "<TR>" & vbCRLF
response.write "<TD WIDTH=1% ><INPUT TYPE='HIDDEN' NAME='ID_" & i &
"'VALUE=" & rstemp("ID") & "></TD>" & vbCRLF
response.write "<TD WIDTH=50% ALIGN=LEFT><INPUT TYPE='text' SIZE=20
NAME='name_" & i & "' VALUE='" & rstemp("Name") & "'></TD>" & vbCRLF
response.write "<TD WIDTH=49% ALIGN=LEFT><INPUT TYPE='text' SIZE=20
NAME='storagespaceassigned_" & i & "' VALUE='" &
Replace(rstemp("StorageSpaceAssigned"),"'","''") & "'></TD>" & vbCRLF
response.write "</TR>" & vbCRLF
rstemp.movenext
loop
response.write "</TABLE>" & vbcrlf
rstemp.close
%>
"Bob Barrows [MVP]" wrote:
> I can't fix what i can't see ... 
>
>
> Jack wrote:
> > Hi Bob,
> > Sorry to get back so long. I finally had time to get back to my code
> > and applied the suggestions you have made. What I saw was that the
> > """ quote approach solved the problem after cleaning my code a bit.
> > However, the replace approach did not get me the desired result. Here
> > still the truncation is occurring. Thanks.
> >
> > "Jack" wrote:
> >
> >> Thanks for the advise Bob. However, both the suggestions did not
> >> work. I think there must be something else going on that is
> >> preventing the display of full field value. I am going to look at
> >> the whole page tomorrow and give you the result.
> >> Best regards.
> >>
> >> "Bob Barrows [MVP]" wrote:
> >>
> >>> Jack wrote:
> >>>> Thanks for your advise Bob. I appreciate it. The statment that is
> >>>> creating problem is:
> >>>> strLink = "<TD WIDTH=10% ALIGN=LEFT><INPUT TYPE='text' SIZE=28
> >>>> NAME='Location_" & i & "' VALUE='" & rstemp("Location") &
> >>>> "'></TD>" & vbCRLF response.write strLink & vbCRLF
> >>>>
> >>>>
> >>>
> >>> My mistake: htmlencode does not do anything about apostrophes (not
> >>> that you shouldn't use it anyways). What you need to do is, if you
> >>> want to use apostrophes for your value's delimiter, you need to
> >>> escape the apostrophes within the value by doubling them up:
> >>>
> >>> strLink = "<TD WIDTH=10% ALIGN=LEFT><INPUT TYPE='text' SIZE=28
> >>> NAME='Location_" & i & "' VALUE='" & _
> >>> Replace(rstemp("Location"),"'","''") & "'></TD>" & vbCRLF
> >>> response.write strLink & vbCRLF
> >>>
> >>> or use real quotes for the value's delimiters:
> >>>
> >>> strLink = "<TD WIDTH=10% ALIGN=LEFT><INPUT TYPE='text' SIZE=28
> >>> NAME='Location_" & i & "' VALUE=""" & rstemp("Location") &
> >>> """></TD>" & vbCRLF
> >>> response.write strLink & vbCRLF
> >>>
> >>> But the latter will have a problem with a Location containing an
> >>> embedded quote (") character.
> >>>
> >>> --
> >>> Microsoft MVP -- ASP/ASP.NET
> >>> Please reply to the newsgroup. The email account listed in my From
> >>> header is my spam trap, so I don't check it very often. You will
> >>> get a quicker response by posting to the newsgroup.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>