12 2008 档案
摘要:首先在web.config文件节点中加入如下代码:
然后,写个类文件,调用上面的定义,代码如下:
'定义一个连接字符串,难点就在这里,网上很多用到了Server.MapPath,但是还是不行,注意这里用到了Request.MapPath(相对asp来说,这是asp所没用的)
Public connstr As String = ConfigurationSettings.AppSettings("myds") + HttpContext.Current.Request.MapPath("~") + (ConfigurationSettings.AppSettings("myconn").Trim())
阅读全文