473,326 Members | 2,133 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,326 software developers and data experts.

Length of an if statement in dotnet (migrating from asp to asp.net)

I have a module that's processed as an include file in a tradtional asp
application that I'm migrating to dotnet.

In one of the modules, there's an if statement that's gotten appended to
over the years it's been in production, that when it's been translated into
dotnet, the if statement (if..... then) itself is several hundred characters
long.

The original statement was similar to:

if session("rpt") = "X1" and (session("user") = "User1" or session("user") =
"User2".....

which has now become

if session("rpt").ToString() = "X1" and (session("user").ToString() =
"User1" or session("user").ToString() = "User2".......

Is there a max length that the if statement can be?

SC

Nov 18 '05 #1
5 1304
Hello jai,

No, but dear God isnt that a maintenance nightmare? Why wouldnt you refactor that as soon as possible?
I have a module that's processed as an include file in a tradtional
asp application that I'm migrating to dotnet.

In one of the modules, there's an if statement that's gotten appended
to over the years it's been in production, that when it's been
translated into dotnet, the if statement (if..... then) itself is
several hundred characters long.

The original statement was similar to:

if session("rpt") = "X1" and (session("user") = "User1" or
session("user") = "User2".....

which has now become

if session("rpt").ToString() = "X1" and (session("user").ToString() =
"User1" or session("user").ToString() = "User2".......

Is there a max length that the if statement can be?

SC

--

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #2
It is somewhat of a maintenance problem, but I wasn't sure if it was the
cause of the problem I'm having.

My reason for not recoding it at this point was if it wasn't a problem (i.e.
the thing that was now breaking the app in dotnet), I didn't want to waste
time fixing it & it not be what was wrong.

If I take out this file from the dotnet application, it will execute; if I
put it in, it will not. The only thing that jumped out to me on this was
the length of the if statement in this module. All the if's and end if's
match up, everything else looks pretty normal.

SC


"Matt Berther" <mb******@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hello jai,

No, but dear God isnt that a maintenance nightmare? Why wouldnt you refactor that as soon as possible?
I have a module that's processed as an include file in a tradtional
asp application that I'm migrating to dotnet.

In one of the modules, there's an if statement that's gotten appended
to over the years it's been in production, that when it's been
translated into dotnet, the if statement (if..... then) itself is
several hundred characters long.

The original statement was similar to:

if session("rpt") = "X1" and (session("user") = "User1" or
session("user") = "User2".....

which has now become

if session("rpt").ToString() = "X1" and (session("user").ToString() =
"User1" or session("user").ToString() = "User2".......

Is there a max length that the if statement can be?

SC

--

--
Matt Berther
http://www.mattberther.com

Nov 18 '05 #3
Why don't you tell us what the error is.
I would be surprised if the compiler actually put a limit on this, as then
it wouldn't be such a good compiler.

<me@privacy.net> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
It is somewhat of a maintenance problem, but I wasn't sure if it was the
cause of the problem I'm having.

My reason for not recoding it at this point was if it wasn't a problem (i.e. the thing that was now breaking the app in dotnet), I didn't want to waste
time fixing it & it not be what was wrong.

If I take out this file from the dotnet application, it will execute; if I
put it in, it will not. The only thing that jumped out to me on this was
the length of the if statement in this module. All the if's and end if's
match up, everything else looks pretty normal.

SC


"Matt Berther" <mb******@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hello jai,

No, but dear God isnt that a maintenance nightmare? Why wouldnt you

refactor that as soon as possible?
I have a module that's processed as an include file in a tradtional
asp application that I'm migrating to dotnet.

In one of the modules, there's an if statement that's gotten appended
to over the years it's been in production, that when it's been
translated into dotnet, the if statement (if..... then) itself is
several hundred characters long.

The original statement was similar to:

if session("rpt") = "X1" and (session("user") = "User1" or
session("user") = "User2".....

which has now become

if session("rpt").ToString() = "X1" and (session("user").ToString() =
"User1" or session("user").ToString() = "User2".......

Is there a max length that the if statement can be?

SC

--

--
Matt Berther
http://www.mattberther.com


Nov 18 '05 #4
If the includes are in, I get the error:

"Common Language Runtime detected an invalid program"

When I try to single-step thru the code.

The last line of code I know executes is a response.redirect into the module
that calls the 2nd one as an include file. I cannot even single-step into
the module, before I get that error message.

SC


"Marina" <so*****@nospam.com> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
Why don't you tell us what the error is.
I would be surprised if the compiler actually put a limit on this, as then
it wouldn't be such a good compiler.

<me@privacy.net> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
It is somewhat of a maintenance problem, but I wasn't sure if it was the
cause of the problem I'm having.

My reason for not recoding it at this point was if it wasn't a problem

(i.e.
the thing that was now breaking the app in dotnet), I didn't want to waste time fixing it & it not be what was wrong.

If I take out this file from the dotnet application, it will execute; if I put it in, it will not. The only thing that jumped out to me on this was the length of the if statement in this module. All the if's and end if's match up, everything else looks pretty normal.

SC


"Matt Berther" <mb******@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hello jai,

No, but dear God isnt that a maintenance nightmare? Why wouldnt you

refactor that as soon as possible?

> I have a module that's processed as an include file in a tradtional
> asp application that I'm migrating to dotnet.
>
> In one of the modules, there's an if statement that's gotten appended > to over the years it's been in production, that when it's been
> translated into dotnet, the if statement (if..... then) itself is
> several hundred characters long.
>
> The original statement was similar to:
>
> if session("rpt") = "X1" and (session("user") = "User1" or
> session("user") = "User2".....
>
> which has now become
>
> if session("rpt").ToString() = "X1" and (session("user").ToString() = > "User1" or session("user").ToString() = "User2".......
>
> Is there a max length that the if statement can be?
>
> SC
>
--

--
Matt Berther
http://www.mattberther.com



Nov 18 '05 #5
Are you sure that the problem lies in the IF statement?
if session("rpt").ToString() = "X1" and (session("user").ToString()
"User1" or session("user").ToString() = "User2"......

If yes, you can improve it a little bi
Dim strRpt as string = session("rpt").ToString()
Dim strUser as string = session("user").ToString()
If strRpt = "X1" And (strUser = "User1" Or strUser = "User2" ........ The

Or even you can use Select Case
If strRpt = "X1" The
Select strUse
Case "User1", "User2" ....
........
End Selec
End If
Nov 18 '05 #6

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

Similar topics

8
by: User | last post by:
Hi, This is very basic, It may be a repost, if so I'm sorry. The problem is that this declaration : Private strMyArray(100) As String will create an array of string with a length of 101,...
5
by: David | last post by:
Hi everyone, I have a ActiveX EXE component written in VB6. This ActiveX EXE exposes various public methods that can be called by several other independent Windows EXE applications (also written...
1
by: KLomax | last post by:
VB6 allowed you to define User types that you could write to file using the statement. This is a nice way to generate fixed length text files. See Below. How do you do this in VB.NET? Thanks,...
0
by: Darshan | last post by:
Can any one help me with how do i go about migrating Centura to Any of dot net platform? Is there any tools available for code conversion?
2
by: pjrhoades | last post by:
Hi Group, I have a small development team developing using Interdev and ASP, we have just landed a project which would greatly benefit from dotNet, so are considering the implications of moving...
8
by: Andy S. | last post by:
Hi, I'm relatively new to DB2. I'm running v 7.2 on Windows XP Pro. I have a SQL statement which is very long (almost 90,000 characters). I have a couple of questions: 1. What is the limit...
3
by: BobRoyAce | last post by:
I would really appreciate recommendations for sources of materials on migrating ASP applications to ASP.NET (books, URL's, etc.). Also, is there a magazine that is particularly good for .NET stuff....
6
by: xfile | last post by:
Hello, I am very new to donet and wondering how to solve the following scenario: (1) Our current hosted site has .Net 1.1 and can be upgraded to 2.0 if needed. Some downtime are expected and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.