tags:

views:

216

answers:

3

Hello, I have this string in vb.net. I would appreciate if you can let me know how I can enclose the values in double quotes

dim str as string=""
str.Append("EmpID=" & empNo & " DeptID=" & deptID & "")

I want the value of string to be EmiID="10" DeptID="20"

Thanks

+1  A: 

Just use double double quotes like:

dim str as string=""
str.Append("EmpID=""" & empNo & """ DeptID=""" & deptID & """")
MicSim
+1  A: 

Use double double quotes to get a single double quote in the string

str.Append("EmpID=""" & empNo & """ DeptID=""" & deptID & """")
JaredPar
A single *double* quote you mean, right? ;-)
Prutswonder
@Prutswonder, correct updated
JaredPar
A: 

Use ControlChars.Quote

dim str as string=""
str.Append("EmpID=" & cControlChars.Quote & empNo & ControlChars.Quote  & " DeptID=" & ControlChars.Quote  & deptID  & ControlChars.Quote)
Jim