473,594 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repost: Values of location field gets truncated in a asp table

Since,
I have not got some desired advise, I am reposting this for some
asnwer/valuable suggestion. Thanks.

THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE

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

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

i = 0
sql01 = "SELECT equipmentTbl.* FROM EquipmentTbl "
sql01 = sql01 & "WHERE EquipmentTbl.Gr antID = " & 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='Equipment ID_" & i &
"' VALUE=" & rstemp("Equipme ntID") & "></TD>" & vbCRLF
response.write strLink & vbCRLF
if session("locked ")<>"Y" then
strLink = "<TD WIDTH=1% ><A TITLE='Click here to delete line'
HREF='ConfirmDe leteEquipmentLi ne.asp?Equipmen tID=" & rstemp("Equipme ntID") &
"'>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><INP UT TYPE='text' SIZE=10
NAME='serialnum _"& i & "' VALUE='" & rstemp("SerialN umber") & "'></TD>" &
vbCRLF
response.write strLink & vbCRLF

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

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

strLink = "<TD WIDTH=10% ALIGN=RIGHT><IN PUT 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><I NPUT TYPE='text' SIZE=1
NAME='Expmonth_ " & i & "'VALUE='" & month(rstemp("D ateAcquired")) & "'>/
<INPUT TYPE='text' SIZE=1 NAME='ExpDay_" & i & "'VALUE='" &
day(rstemp("Dat eAcquired")) & "'>/ <INPUT TYPE='text' SIZE=2 NAME='Expyear_"
& i & "'VALUE='" & year(rstemp("Da teAcquired")) & "'></TD>" & vbCRLF
'************** *
response.write strLink & vbCRLF

response.write "</TR>" & vbCRLF

totalcost=total cost+rstemp("Co st")
'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("ICertif y")
FinancialOffice r = rstemp("Financi alOfficer")
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("Locatio n") & "<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.

Jan 11 '06 #1
12 2213
Jack wrote:
Thus all character including and after the single quote(') is getting
truncated.


Use Server.HTMLEnco de to encode the location values before writing them to
Response
Bob Barrows
--
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.
Jan 11 '06 #2
Thanks for your advise Bob. I appreciate it. The statment that is creating
problem is:
strLink = "<TD WIDTH=10% ALIGN=LEFT><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></TD>" & vbCRLF
response.write strLink & vbCRLF
In the above statement, when I am writing Server.HTMLEnco de(strLink), I am
still getting the truncated value in the location field. I do not know how to
handle it in the above code as it is not a direct
response.write( rstemp("Locatio n")). Any further ideas? Regards.

"Bob Barrows [MVP]" wrote:
Jack wrote:
Thus all character including and after the single quote(') is getting
truncated.


Use Server.HTMLEnco de to encode the location values before writing them to
Response
Bob Barrows
--
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.

Jan 11 '06 #3

Jack wrote:
Thanks for your advise Bob. I appreciate it. The statment that is creating
problem is:
strLink = "<TD WIDTH=10% ALIGN=LEFT><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></TD>" & vbCRLF
response.write strLink & vbCRLF
In the above statement, when I am writing Server.HTMLEnco de(strLink), I am
still getting the truncated value in the location field. I do not know how to
handle it in the above code as it is not a direct
response.write( rstemp("Locatio n")). Any further ideas? Regards.


Try VALUE=""" & rstemp("Locatio n") & """

That's 3 sets of double quotes either side of & rstemp("Locatio n") &

/P.

Jan 11 '06 #4
Jack wrote:
Thanks for your advise Bob. I appreciate it. The statment that is
creating problem is:
strLink = "<TD WIDTH=10% ALIGN=LEFT><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></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><INP UT 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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE=""" & rstemp("Locatio n") & """></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.
Jan 11 '06 #5
Hi Paxton,
I tried putting 3 sets of double quotes. Still it does not work. Still
waiting for some
answer. Thansks anyway.
Regards.

"Paxton" wrote:

Jack wrote:
Thanks for your advise Bob. I appreciate it. The statment that is creating
problem is:
strLink = "<TD WIDTH=10% ALIGN=LEFT><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></TD>" & vbCRLF
response.write strLink & vbCRLF
In the above statement, when I am writing Server.HTMLEnco de(strLink), I am
still getting the truncated value in the location field. I do not know how to
handle it in the above code as it is not a direct
response.write( rstemp("Locatio n")). Any further ideas? Regards.


Try VALUE=""" & rstemp("Locatio n") & """

That's 3 sets of double quotes either side of & rstemp("Locatio n") &

/P.

Jan 11 '06 #6
Jack, it works. Try this in a test page:
<%@ Language=VBScri pt %>
<%
dim s, t
s="Conference Room's Cabinet"
t="<input type=""text"" value=""" & s & """ style=""width:2 00px"">"
Response.Write t

%>

Jack wrote:
Hi Paxton,
I tried putting 3 sets of double quotes. Still it does not work. Still
waiting for some
answer. Thansks anyway.
Regards.

"Paxton" wrote:

Jack wrote:
Thanks for your advise Bob. I appreciate it. The statment that is
creating problem is:
strLink = "<TD WIDTH=10% ALIGN=LEFT><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></TD>"
& vbCRLF response.write strLink & vbCRLF
In the above statement, when I am writing
Server.HTMLEnco de(strLink), I am still getting the truncated value
in the location field. I do not know how to handle it in the above
code as it is not a direct response.write( rstemp("Locatio n")). Any
further ideas? Regards.


Try VALUE=""" & rstemp("Locatio n") & """

That's 3 sets of double quotes either side of & rstemp("Locatio n") &

/P.


--
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.
Jan 11 '06 #7
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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></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><INP UT 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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE=""" & rstemp("Locatio n") & """></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.

Jan 12 '06 #8
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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") & "'></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><INP UT 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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE=""" & rstemp("Locatio n") & """></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.

Jan 18 '06 #9
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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE='" & rstemp("Locatio n") &
"'></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><INP UT 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><INP UT TYPE='text' SIZE=28
NAME='Location_ " & i & "' VALUE=""" & rstemp("Locatio n") &
"""></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.
Jan 18 '06 #10

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

Similar topics

2
3295
by: arenaTR | last post by:
I wanted to respost this question becuase I didn't think I was very clear in my earlier post. After doing some db work in a php script, from the same script, i want to call a CGI script with a bunch of strings. I've tried: header("Location: http://mydomain.com/cgi-local/sendemail.cgi?"); To no avail. Following this script is a simple header for an HTML page redirect, which does work. in fact, the cgi call doesn't work at all, but
0
1388
by: James Johnson | last post by:
All, I'm building a member signup form. Fields that contain more than one word are being truncated when being inserted into the MySQL table. I'm using this code that I got from one of my PHP books. $as_addr1 = addslashes($_POST);$tr_addr1 = trim($as_addr1); So, if I post "1122 Boogie St." it gets inserted as "1122". If I remove the
2
1803
by: Ohaya | last post by:
Hi, We've been having a problem with one particular page that has a button on it, and a "tall" image (top-to-bottom). The button calls some simple Javascript to print the frame in which the image is located, and what is happening in the field is that the image only gets partly printed. Only the first page gets printed, and the bottom of the image, which should get printed on a 2nd page, is not printed. Also, the bottom of the first...
1
1618
by: Richard Coutts | last post by:
I have two select queries, "qryJobSpecsAlwaysList" and "qryJobSpecsBySchedCat," that list some fields, including a Memo field called "Description" that can contain text values that can be 500 characters or more. Both queries work great. Now I need to combine the two outputs into a single output. So I wrote a simple Union query that looks like this: SELECT qryJobSpecsAlwaysList.Description FROM qryJobSpecsAlwaysList;
4
2088
by: bhieb | last post by:
Alright this is a new one to me. I have linked a table using ODBC to our AS400. When I either open it directly or query it I get the incorrect values for several fields. For example the query on the linked table returns these 5 records... CUCUST CUALPH 0188 RITA 0188 RITA 0188 RITA 0188 RITA
0
1721
by: bunty.gopal | last post by:
I am trying to use the PreparedStatement's addBatch to load data in an ETL-like process into a table. There is a single prepared statement. The parameters are set on it and prepStmt.addBatch() is called. Then the next iteration of setting the params and adding to batch begins. Finally after setting the batch of 2 to 2000 rows, the prepStmt.executeBatch() is called. If the last row contains a null value for a particular DECIMAL field,...
4
2230
by: Jack | last post by:
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
1
5149
by: bunty.gopal | last post by:
This is the solution to the issue in the subject, question itself was posted in a previous thread long back. Use the latest DB2 db2cc.jar fixpack on the client, or add "deferPrepares=false" to the connection string when opening the connection (or connection pool properties, if deployed on a server like weblogic). The issue can be resolved using either of these options. Gopal
1
4912
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In the corresponding input field (text box) the user enters a new category order which gets stored in...
0
7882
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8259
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8377
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6669
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5836
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3871
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3905
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2391
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
1487
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.