查看: 1120|回复: 2
|
declare "global" sql
[复制链接]
|
|
请问asp.net如何把sql declare 为 global variable? 因为我很多forms link 去 同一个database.我不想重复在每个form declare 一样的sql connection |
|
|
|
|
|
|
|
发表于 28-2-2005 11:41 PM
|
显示全部楼层
web.config
<appSettings>
<add key="DBConnection" value="Data Source=localhost;Initial Catalog=your db;Integrated Security=SSPI"/>
</appSettings>
webform1.aspx,webform2.aspx........webformN.aspx
using System.Configuration;
string conn_str=ConfigurationSettings.AppSettings["DBConnection"];
: |
|
|
|
|
|
|
|
楼主 |
发表于 1-3-2005 12:57 AM
|
显示全部楼层
web.config
<appSettings>
<add key="DBConnection" value="Data Source=localhost;Initial Catalog=your db;Integrated Security=SSPI"/>
</appSettings>
<----------error with adding appSetting? |
|
|
|
|
|
|
| |
本周最热论坛帖子
|