473,394 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Contants and Parameter Name

I have a global class GClass with 2 contants. Both are declared public in the
form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a default
value (see code excerpt below) the program bombs, but when I use a hardcoded
value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="<%
GClass.Const1 %>" />

Working Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="xxx" />

Thanks,
David
Jul 8 '06 #1
7 1136
V
To access it like this, you would need to declare your constant as
static.

- V

dwg1011 wrote:
I have a global class GClass with 2 contants. Both are declared public in the
form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a default
value (see code excerpt below) the program bombs, but when I use a hardcoded
value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="<%
GClass.Const1 %>" />

Working Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="xxx" />

Thanks,
David
Jul 9 '06 #2
You can't declare a constant as static.

V wrote:
To access it like this, you would need to declare your constant as
static.

- V

dwg1011 wrote:
>I have a global class GClass with 2 contants. Both are declared public in the
form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a default
value (see code excerpt below) the program bombs, but when I use a hardcoded
value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="<%
GClass.Const1 %>" />

Working Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="xxx" />

Thanks,
David
Jul 9 '06 #3
Unless you have ported the framework to an Atari, I don't really think
that the program bombs. ;)

What error message do you get? Often the error message tells you exactly
what is wrong.

dwg1011 wrote:
I have a global class GClass with 2 contants. Both are declared public in the
form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a default
value (see code excerpt below) the program bombs, but when I use a hardcoded
value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="<%
GClass.Const1 %>" />

Working Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="xxx" />

Thanks,
David

Jul 9 '06 #4
V
What I meant is that the constant that he is declaring, he should make
it a static variable, because he is trying to access it using the Class
name.

You are right, that you cannot declare a constant static. :)

- V

Göran Andersson wrote:
You can't declare a constant as static.

V wrote:
To access it like this, you would need to declare your constant as
static.

- V

dwg1011 wrote:
I have a global class GClass with 2 contants. Both are declared publicin the
form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a default
value (see code excerpt below) the program bombs, but when I use a hardcoded
value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="<%
GClass.Const1 %>" />

Working Version:

<SelectParameters>
<asp:Parameter Name="Catalog" Type="String"
DefaultValue="xxx" />

Thanks,
David
Jul 9 '06 #5
dwg1011 wrote:
I have a global class GClass with 2 contants. Both are declared
public in the form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a
default value (see code excerpt below) the program bombs, but when I
use a hardcoded value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%
GClass.Const1 %>" />
Shouldn't that be:-
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%=GClass.Const1 %>" />

?

i.e. no new line splitting the name/value pair to potentially confuse it,
and an equals sign.

Andrew
Jul 11 '06 #6
The spacing was just the way it posted. If I am not mistaken the =varname is
"classic" ASP formatting while .net does not require it.

David

"Andrew Morton" wrote:
dwg1011 wrote:
I have a global class GClass with 2 contants. Both are declared
public in the form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a
default value (see code excerpt below) the program bombs, but when I
use a hardcoded value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%
GClass.Const1 %>" />

Shouldn't that be:-
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%=GClass.Const1 %>" />

?

i.e. no new line splitting the name/value pair to potentially confuse it,
and an equals sign.

Andrew
Jul 12 '06 #7
>dwg1011 wrote:
>>I have a global class GClass with 2 contants. Both are declared
public in the form:

PUBLIC Const Const1 = "xxx". When I try to use the constant as a
default value (see code excerpt below) the program bombs, but when I
use a hardcoded value it works fine. Any ideas?

Failing Version:

<SelectParameters>
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%
GClass.Const1 %>" />
"Andrew Morton" wrote:
>Shouldn't that be:-
<asp:Parameter Name="Catalog"
Type="String"
DefaultValue="<%=GClass.Const1 %>" />

?

i.e. no new line splitting the name/value pair to potentially
confuse it, and an equals sign.
dwg1011 wrote:
The spacing was just the way it posted. If I am not mistaken the
=varname is "classic" ASP formatting while .net does not require it.
Did you try it? I only use code-behind rather than in-line code.

What actually goes wrong? "Bombs" is vague.
*However* I now think it can't work that way. You would have to do it like:-

<%@ Page Language="VB" %>
<script runat="server">
Const const1 as string="xxx"
Sub Page_Load(obj as object, e as eventargs)
Catalog.DefaultValue=const1
End Sub
</script>
[other stuff]
<SelectParameters>
<asp:Parameter Id="Catalog" Name="Catalog" Type="String" />

Any use?

Andrew
Jul 13 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Boba | last post by:
Hi, I'm using python as the language in ASP pages to query a database ussing the com interface. I want to do a parameter query and I have to use constants like Null and Nothing. Does anyone know...
0
by: David Furey | last post by:
Hi, I am using the XSLT document to filter records from an XML document The XSL is shown below: I have a parameter named "search-for" that is used to bring back a list of Vendor Names that...
2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
2
by: J Krugman | last post by:
I have a form with a couple of submit buttons, plus a "pseudolink" that is also supposed to submit the form; the submitted form data feeds to a CGI script. The two submit buttons have the name...
2
by: systemutvecklare | last post by:
Hi! I have an application that generates an html-form from an xml-file using an xsl-file. My problem is that I want the xsl to use some "unknown" parameters that I pass to the xslt processor...
1
by: Steve Lilley | last post by:
Hello Can anyone help me with the following ? I have a table like this.... User_ID User_name User_email 1 Steve stelil@test.com
5
by: Ram | last post by:
Hi Friends I want to develope a custom control in .net which can be used with any project. I am writing a function in that class which I want to take any object as parameter. For that I have...
0
by: Managed Code | last post by:
Hello, I have a status and definition table. The status table's current status field relates the ID field of the definition table. I am trying to retrieve the definitions that are associated...
3
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.