在 VB6 中转义字符串中的引号 [英] Escaping quotes in a string in VB6

查看:27
本文介绍了在 VB6 中转义字符串中的引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对旧的 VB Web 应用程序进行一些小的更改,我需要在字符串中添加引号,但到目前为止我没有运气.字符串是

I am trying to make some small changes to an old VB web app I need to add quotes inside of a string I've had no luck so far. The string is

Dim sql As String = "Select * from  Usertask Where UserId = " & Session("UserId") & " and JobID=" & ddlReqTask.SelectedValue

我需要在 Session("UserID") 值周围添加引号.

I need to add quotes around the Session("UserID") value.

推荐答案

您可以使用 "" 在字符串中插入引号,例如:

You can use "" to insert a quote into a string e.g:

dim sometext as String = "Hello ""Frank"" 你好吗?"

给你什么

你好弗兰克",你好吗?

Hello "Frank" how are you?

这篇关于在 VB6 中转义字符串中的引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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