Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2006, 05:31 PM
Authorized User
 
Join Date: Dec 2005
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rdove84
Default

I just tried changing to using a DataSet instead to see if I would get the same results and I did so even though .hasRows is coming back true I am somehow not connecting to the database properly.

Back to the drawing board. Thank you for you help.

 
Old November 14th, 2006, 05:10 PM
Authorized User
 
Join Date: Dec 2005
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rdove84
Default

I finally solved this particular issue. The resolution to the problem was using ExecuteScalar rather than ExecuteReader to retrieve the information I needed. Here is the code that resolved my problem, in case anyone else can use it:

SqlConnection sqlConn = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
sqlConn.Open();

int knownID;

SqlCommand sqlCmd = new SqlCommand();
sqlCmd = new SqlCommand("SELECT MAX(ID) FROM middle", sqlConn);

knownID = (int)sqlCmd.ExecuteScalar();

    if(knownID > 10)
    {
        Response.Redirect("RegFull.aspx");
    }
    else
    {
        Response.Redirect("Registration.aspx"); }
    sqlConn.Close();







Similar Threads
Thread Thread Starter Forum Replies Last Post
identity column id find!! keyvanjan Classic ASP Basics 7 January 20th, 2007 01:12 PM
redirect to page other than default page sarah lee ASP.NET 1.0 and 1.1 Basics 3 December 15th, 2006 05:45 PM
Pass ID to redirect page? okboy ASP.NET 2.0 Basics 2 December 14th, 2006 06:12 PM
Redirect to new page without closing current page peter2004 ASP.NET 2.0 Basics 5 June 5th, 2006 08:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.