开发者

How to read a Web.Config in Powerbuilder 11.5.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.


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


You could try something like this code below:

String ls_key, ls_value
#IF DEFINED PBWEBSERVICE THEN
    ls_key = 'database'   
    ls_value = GetConfigSettings(ls_key)   
#END IF

I hope this can also help you.

Deise

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜