Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to append quotes

Status
Not open for further replies.

G12Consult

Programmer
May 12, 2016
77
AU
I am trying to add " to my string so that I can use it in a connection string.

Not sure how or where to add it.

Code:
 Dim strConnectionString As String strConnectionString = Session("connectionString") e.g. returns TENANT_1432]

but it needs to be "TENANT_1432" to use in the code below.



Code:
 'Start Login Authentication 
Dim constring As String = ConfigurationManager.ConnectionStrings(strConnectionString).ConnectionString]
 
I am not sure why you would need quotes around the value. Maybe you could explain further. But to answer your questions you could do this:
Dim constring As String = '"' + ConfigurationManager.ConnectionStrings(strConnectionString).ConnectionString] + '"'

If you can't read it '"' = single quote, double quote, single quote
 
I am trying to dynamically select a database depending on who is trying to log in.

I have the database connections stored in a config file, so I just need to dynamically populate the connection string name
 
If this is VB, ' is a comment so '"' will not work. Use "" (2 double quotes) instead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top