Home All Groups Group Topic Archive Search About

use varible value in include file

Author
31 Aug 2006 4:13 PM
martin1
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

Author
31 Aug 2006 4:23 PM
Spam Catcher
=?Utf-8?B?bWFydGluMQ==?= <mart***@discussions.microsoft.com> wrote in
news:C7CEC9D7-FFEF-47A9-975F-B0015C0DDEA8@microsoft.com:

> 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).
Author
31 Aug 2006 4:36 PM
martin1
Hi, Spam,

could you give sample to store value in web.config appsettings section?

Thanks

Show quoteHide quote
"Spam Catcher" wrote:

> =?Utf-8?B?bWFydGluMQ==?= <mart***@discussions.microsoft.com> wrote in
> news:C7CEC9D7-FFEF-47A9-975F-B0015C0DDEA8@microsoft.com:
>
> > 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).
>
Author
31 Aug 2006 8:58 PM
Spam Catcher
=?Utf-8?B?bWFydGluMQ==?= <mart***@discussions.microsoft.com> wrote in
news:28D32142-61DB-4459-9306-95B2EF802740@microsoft.com:

> 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.
Author
1 Sep 2006 3:52 PM
martin1
Thank you! Spam,

I figure out

Show quoteHide quote
"Spam Catcher" wrote:

> =?Utf-8?B?bWFydGluMQ==?= <mart***@discussions.microsoft.com> wrote in
> news:28D32142-61DB-4459-9306-95B2EF802740@microsoft.com:
>
> > 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.
>