use varible value in include file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, All

below is the seperate include file called CommonVarValue.aspx
<%
Dim dcnid as integer
dcnid = 67
%>

then another aspx file has sqlDataSource section whose selectCommand needs
to use dcnid value, the code is like below, anyone knows what is correct
format to use the value?

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM table1 where id = dcnid ">

</asp:SqlDataSource>

Thanks
 
then another aspx file has sqlDataSource section whose selectCommand
needs to use dcnid value, the code is like below, anyone knows what is
correct format to use the value?

Create a shared (static) class and store all your values in there.

Alternatively you can store values in your app.config/web.config too (in
the appsettings section).
 
could you give sample to store value in web.config appsettings section?

Take a look at the System.Configuration.ConfigurationManager classes (.NET
2.0).

ConfigurationSettings in .NET 1.1.
 
Thank you! Spam,

I figure out

Spam Catcher said:
Take a look at the System.Configuration.ConfigurationManager classes (.NET
2.0).

ConfigurationSettings in .NET 1.1.
 
Back
Top