重新发布:位置字段的值在asp表中被截断 [英] Repost: Values of location field gets truncated in a asp table

查看:66
本文介绍了重新发布:位置字段的值在asp表中被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为,

我没有得到一些理想的建议,我将这个转发给一些

asnwer /有价值的建议。谢谢。


以下是ASP页面代码的一部分

<%

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)

直到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
如果会话(已锁定)<>Y,则为
然后

strLink ="< TD WIDTH = 1%>< A TITLE =''点击此处删除行''

HREF =''ConfirmDeleteEquipmentLine。 ?ASP EquipmentID = QUOT; &安培; rstemp(" EquipmentID")&

"''>删除< / A>< / TD>" &安培; vbCRLF

response.write strLink& vbCRLF

else

strLink ="< TD WIDTH = 1%>< / A>< / TD>" &安培; vbCRLF

response.write strLink& vbCRLF

结束如果

strLink ="< TD WIDTH = 10%ALIGN = LEFT>< INPUT TYPE =''text''SIZE = 10
NAME =''serialnum_"&我和我''VALUE =''" &安培; rstemp(SerialNumber)& ">< / TD>" &

vbCRLF

response.write strLink& vbCRLF


strLink ="< TD WIDTH = 40%ALIGN = LEFT>< INPUT TYPE =''text''SIZE = 45

NAME = '' &Desc_ QUOT;&安培;我和我''VALUE =''" &安培; rstemp(" Description")& ">< / TD>" &安培; vbCRLF

response.write strLink& vbCRLF


strLink ="< TD WIDTH = 10%ALIGN = LEFT>< INPUT TYPE =''text''SIZE = 28

NAME = '' &位置指定:QUOT; &安培;我和我''VALUE =''" &安培; rstemp(位置)& ">< / TD>" &安培; vbCRLF

response.write strLink& vbCRLF

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


strLink ="< TD WIDTH = 10%ALIGN = RIGHT>< INPUT TYPE =''text''SIZE = 12

NAME =''Cost_" &安培;我和我''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_ QUOT; &安培;我和我" VALUE =" &安培;月(rstemp(" DateAcquired"))& "''> /

< INPUT TYPE =''text''SIZE = 1 NAME =''ExpDay_" &安培;我和我" VALUE =" &

day(rstemp(" DateAcquired"))& "''> /< INPUT TYPE =''text''SIZE = 2 NAME =''Expyear_"

&我和我" VALUE =" &安培;年(rstemp(" DateAcquired"))& ">< / TD>" &安培; vbCRLF

''***************

response.write strLink& vbCRLF


response.write"< / TR>" &安培; vbCRLF

totalcost = totalcost + rstemp(" Cost")

''保存复选框值和财务人员姓名。所有记录都应该是

相同,因为每次点击UPDATE按钮时,它都会更新。

点击。

''复选框和名称是多余的,但这是它最初的方式

设置

''决定顺其自然而不是尝试将这些值保存在



''GrantTBL中,这样它们就不会多余。

ICertify = rstemp(" ICertify")

FinancialOfficer = rstemp(" FinancialOfficer")

rstemp.movenext

loop

rstemp.close

%>

< / TR>

在上面的代码中,这是一个输入屏幕(以及显示屏幕)所有

从上述记录集中捕获特定GrantId的设备行

,并通过上述

循环以表格格式显示。问题是对于各行的位置值

,如果行中有单引号,则

只有部分值被捕获在

这个生成的表的位置列。


我添加了一个response.write rstemp(" Location")& "<峰; br>"声明要查看

从对应于locaion字段的后端表中检索的值

。在目前的

场景中,以下是结果即在这里我们可以看到单个

报价

按原样检索。结果如下:


会议室的柜子

服务器房间

Don''s Room
服务器机房


但是,在asp生成的位置列表中,值为

,如下所示:

会议室

Server Rooom

Don

服务器室


因此所有角色包括和在单引号('')之后

被截断。


我不知道为什么这些截断发生时行是

在asp表中动态形成

但是通过使用response.write语句检索整个值。并且

这个问题的解决方案是什么,所以

生成的asp表中的位置字段显示没有任何

截断的数据。 />

感谢任何帮助。


提前致谢。

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.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.

推荐答案

Jack写道:
因此所有字符包括和单引号('')之后都会被截断。
Thus all character including and after the single quote('') is getting
truncated.




使用Server.HTMLEncode对位置值进行编码,然后再写入

回复

Bob Barrows

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。



Use Server.HTMLEncode 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.


感谢您的建议Bob。我很感激。创建

问题的声明是:

strLink ="< TD WIDTH = 10%ALIGN = LEFT>< INPUT TYPE =''text''SIZE = 28

NAME =''Location_" &安培;我和我''VALUE =''" &安培; rstemp(位置)& ">< / TD>" &安培; vbCRLF

response.write strLink& vbCRLF

在上面的语句中,当我编写Server.HTMLEncode(strLink)时,我仍然在位置字段中获得截断值。我不知道如何在上面的代码中处理它,因为它不是直接的

response.write(rstemp(" Location"))。还有什么想法?问候。


" Bob Barrows [MVP]"写道:
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
In the above statement, when I am writing Server.HTMLEncode(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("Location")). Any further ideas? Regards.

"Bob Barrows [MVP]" wrote:
杰克写道:
因此所有字符包括和单引号('')之后都会被截断。
Thus all character including and after the single quote('') is getting
truncated.



使用Server.HTMLEncode对位置值进行编码,然后再将其写入
响应
Bob Barrows
-
Microsoft MVP - ASP / ASP。 NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将得到更快的回复。



Use Server.HTMLEncode 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.





杰克写道:

Jack wrote:
感谢您的建议Bob。我很感激。创建
问题的声明是:
strLink ="< TD WIDTH = 10%ALIGN = LEFT>< INPUT TYPE =''text''SIZE = 28
NAME = '' 位置指定:" &安培;我和我''VALUE =''" &安培; rstemp(位置)& ">< / TD>" &安培; vbCRLF
response.write strLink& vbCRLF

在上面的语句中,当我编写Server.HTMLEncode(strLink)时,我仍然在位置字段中获得截断值。我不知道如何在上面的代码中处理它,因为它不是直接的
response.write(rstemp(" Location"))。还有什么想法?问候。
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
In the above statement, when I am writing Server.HTMLEncode(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("Location")). Any further ideas? Regards.




尝试VALUE =""" &安培; rstemp(位置)& """


这是& of& rstemp(" Location")&


/ P.



Try VALUE=""" & rstemp("Location") & """

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

/P.


这篇关于重新发布:位置字段的值在asp表中被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆