views:

127

answers:

1

My office mate created a web service application to be consumed by a .Net application on the presentation layer. He wants to read the connection string from the web.config. Thank you in advance.

+3  A: 

Web Forms has GetConfigSettings(), but for web services, I'd guess you'd need something like this:

#IF Defined PBDOTNET THEN
System.Collections.Specialized.NameValueCollection cs

cs = System.Configuration.ConfigurationManager.AppSettings
SQLCA.DBMS = cs["ConnectionDBMS"]
SQLCA.DBParm = cs["ConnectionDBParm"]
SQLCA.AutoCommit = (Lower (cs["ConnectionAutoCommit"]) = "true")
SQLCA.LogID = cs["ConnectionLogID"]
SQLCA.LogPass = cs["ConnectionLogPass"]
SQLCA.ServerName = cs["ConnectionServerName"]
#END IF

I'm pretty sure this was working code at one point, but I abandoned it long ago for GetConfigSettings(). It should at least get you going in the right direction, I hope.

Good luck,

Terry

Terry
Thank you very much for your prompt response. I will try this one.
RJ1516