帮我看看哪里出错啦

zky0901 2007-12-23 12:13:17
刚学习asp.net,模仿书上的例子,可演示总出错,请大家告诉我是为什么啊
<script language="vb" runat="server">
sub page_load(sender as object,e as eventargs)
dim aa as byte=3
select case aa
case 1
response.write (aa&"的英文为"&"ONE")
case 2
response.write (aa&"的英文为"&"two")
case 3
response.write (aa&"的英文为"&"three")
case 4
response.write (aa&"的英文为"&"four")
case 5
response.write (aa&"的英文为"&"five")
case else
response.write ("数字超过范围!")
end select
end sub
</script>

出错提示如下:
Server Error in '/test' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30277: Type character '&' does not match declared data type 'Byte'.

Source Error:



Line 4: select case aa
Line 5: case 1
Line 6: response.write (aa&"的英文为"&"ONE")
Line 7: case 2
Line 8: response.write (aa&"的英文为"&"two")

...全文
73 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zky0901 2007-12-23
  • 打赏
  • 举报
回复
谢谢上面几位,已经找到问题了,是&前后要留下空格就行了,如response.write (aa & "的英文为" & "ONE")
fengniumaxi 2007-12-23
  • 打赏
  • 举报
回复
你的连接符错了,&出问题了aa+"的英文为"+"ONE")这样看行不
LikeCode 2007-12-23
  • 打赏
  • 举报
回复
连字符号错了,不知道VBNET是怎么样.试试这样:


response.write ("{0}的英文为ONE",aa)
'下面的也类同
'另外,象"的英文为"&"two"显然是可以当一个字符串的,不要多此一举分成两截又连拉.
songle912 2007-12-23
  • 打赏
  • 举报
回复
Type character '&' does not match declared data type 'Byte'.

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧