Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: fix for problem with SqlCommand object


Message #1 by "Louis T. Klauder Jr." <lklauder@w...> on Fri, 10 Aug 2001 17:11:47 -0400
Hi;

I finally got past the problem on which I 
asked help earlier. To recap, the problem
was: page one redirects to page two; both pages
open connections to a SQL database and 
populate dropdown lists from two different
SQL tables; when the browser activated page 
two there was an error with the select command
and hitting browser "back" followed by browser
"forward" cleared the error and let page two's 
SQL access work OK.

After trying "this, that & the other", I tried
doctoring the code for page two so that it 
could be activated on its own directly. When 
page two was activated directly, the SQL access 
and dropdown population worked fine. Then going 
back to the intended sequence in which page two
is opened by page one, I happened to comment out 
the connection.Close() statement that was in the
page one c# code prior to the Response.Redirect 
statement that activates page two, and that fixed 
the problem. (Could use Server.Transfer, in place
of Response.Redirect but in this error situation
you would then be trapped in page one and the 
browser would not show the error message.)

I am glad to have it fixed, but it would also
be nice to understand what is going on. The
connection is named differently in the two
pages (which should be immaterial since the
each connections belongs to the class for its
own page) but the two connections have identical 
connection strings and so are presumably in the 
same connection pool.

Any takers?

Lou

  Return to Index