E
estafford
I am having trouble writing a conditional block using ASP.NET and C#.
I am trying to do something like this:
1. if page is PostBack
- transfer to another page
2. if not postback
- connect to database and get information using a querystring id and create
a DataReader (as DR).
- generate a Form to display using values from the database query.
The problem is that I get an error:
The name 'DR' does not exist in the class or namespace 'ASP.contact_aspx'
Because the page is not postback, the DataReader object is not created.
Is there any way around this?
I assumed that the code in condition 2 would be skipped because the
condition was false but it seems to trying to run through it anyway.
This process works in classic ASP but I cannot get it to work in ASP.NET.
I'd like to try to keep this confined to one page.
Suggestions??
I am trying to do something like this:
1. if page is PostBack
- transfer to another page
2. if not postback
- connect to database and get information using a querystring id and create
a DataReader (as DR).
- generate a Form to display using values from the database query.
The problem is that I get an error:
The name 'DR' does not exist in the class or namespace 'ASP.contact_aspx'
Because the page is not postback, the DataReader object is not created.
Is there any way around this?
I assumed that the code in condition 2 would be skipped because the
condition was false but it seems to trying to run through it anyway.
This process works in classic ASP but I cannot get it to work in ASP.NET.
I'd like to try to keep this confined to one page.
Suggestions??