狂风系列问题:怎么会事呀,很简单,但搞不定?在线等?

mygodness 2002-08-23 11:17:40
关于使用数据库的:
以下语句可以:
strsql="update table1 set u_check=u_check+1 where u_text='太糟了,快改行吧'"
comdtmp=new oledbcommand(strsql,myconnection)
comdtmp.executenonquery()
而改成:
dim strtemp as string="太糟了,快改行吧"
strsql="update table1 set u_check=u_check+1 where u_text="&strtemp
comdtmp=new oledbcommand(strsql,myconnection)
comdtmp.executenonquery()
就不行,为什么
...全文
36 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mygodness 2002-08-24
  • 打赏
  • 举报
回复
i have changed it well,but i still should thank to you!really!
i have change it like this:


strsql="update table1 set u_check=u_check+1 where u_text='"+strtemp
+"'"

thank you,i will give you "分" later
mygodness 2002-08-24
  • 打赏
  • 举报
回复
i have changed a little,then show you the error

说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误信息: BC30277: 类型字符“&”与声明的数据类型“String”不匹配。

源错误:



行 60: myconnection.open()
行 61: strsql="update table1 set u_check=u_check+1 where u_text='"&strtemp
行 62: strsql=strsql&"'"
...


源文件: c:\inetpub\wwwroot\Default.aspx 行: 62
saucer 2002-08-24
  • 打赏
  • 举报
回复
if it does not work, then show the errors
mygodness 2002-08-24
  • 打赏
  • 举报
回复
我也有想过,试过,但不行
xqchang 2002-08-24
  • 打赏
  • 举报
回复
saucer(思归) 的是对的,注意,连接符号“&”的前后都有空格的,你的字符串是错误的。
saucer 2002-08-23
  • 打赏
  • 举报
回复
try

strsql="update table1 set u_check=u_check+1 where u_text='" & strtemp & "'"

62,046

社区成员

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

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

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

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