asp.net I can't figure this out I have deleted fields from the database & the Stored procedure but it still giving me an error

I am getting this error.  return from this procedure (see in block code) I have deleted the db fields
'Sat_Static_Display'  & 'Sun_Static_Display' from the procedure but 'Sat_Static_Display' still shows up as if it's still in the procedure. The Database flied have been deleted also.

Server Error in '/pbfpr' Application.
--------------------------------------------------------------------------------
Sat_Static_Display
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Sat_Static_Display

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[IndexOutOfRangeException: Sat_Static_Display]
   System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName) +4839010
   System.Data.SqlClient.SqlDataReader.GetOrdinal(String name) +67
   System.Data.SqlClient.SqlDataReader.get_Item(String name) +15
   ASPNetPortal.PilotReg.Page_Load(Object sender, EventArgs e) in c:\documents and settings\dennis west\vswebcache\www.planoballoonfest.org\pbfpr\pilotreg.aspx.cs:223
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

 

----------------------------------------------------------------------------
CREATE PROCEDURE GetSinglePilotsID
(
    @PilotsID  Int

)
AS

SELECT   App_Recd, FirstName, LastName, Company, Address1, Address2, City, State, Zip, HomePhone, WorkPhone, CellPhone, FaxNumber,  Email, Certificate_Type, TotalHours, Hours12Mos, Name_of_Balloon, Registration, Manufacturer, Balloon_Type, Year, Hours, Sport_Comm, Special_Shape, Addt_Crew, How_Many_Crew, Fri_AM, Fri_PM, Sat_AM, Sat_PM, Sun_AM, Sun_PM, Media_Flt, How_Many_Media, Fun_Flt, Polo_Shirt, Sweat_Shirt, Arrival, Preference, Deposit, Invitation_List,Comments, Insurance

FROM
   Pilots

WHERE
      PilotsID =  @PilotsID
GO

Open in new window

westdhAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iopenCommented:
Must still be a reference to Sat_Static_Display in your code?
0
Carl TawnSystems and Integration DeveloperCommented:
What the error and stack trace are telling you is that somewhere in your code you have a DataReader where you are trying to retrieve a value based on the column name "Sat_Static_Display". The issue is in your code, not with the database.
0
SteveCommented:
Should the Page_Load be loading EventArgs from
c:\documents and settings\dennis west\vswebcache\www.planoballoonfest.org\pbfpr\pilotreg.aspx.cs:223
?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

westdhAuthor Commented:
No...
found the problem in my signin code..
I have now created a new inline code for the sign-in page and am having a problem with it.
------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0038: Cannot access a non-static member of outer type 'System.Web.UI.UserControl' via nested type 'ASP.desktopmodules_signin_ascx.Signin'

Source Error:

Line 45:
Line 46:                   //Session["PilotID"] = System.Convert.ToInt32(dr["PilotID"]);
Line 47:                   Session["PilotsID"] = dr["PilotsID"];
Line 48:                   //PilotId = dr["PilotsID"];
Line 49:
 
Source File: e:\hosting\member\planofest\pbfpr\DesktopModules\Signin.ascx    Line: 47

<%@ Control language="c#" Inherits="ASPNetPortal.Signin" CodeBehind="Signin.ascx.cs" AutoEventWireup="false" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.ComponentModel" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Caching" %>
<%@ Import Namespace="System.Web.SessionState" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Web.Security" %>

<script runat="server">

public abstract class Signin 
{
        protected System.Web.UI.WebControls.ImageButton SigninBtn;
	protected System.Web.UI.WebControls.TextBox FirstName;
	protected System.Web.UI.WebControls.TextBox LastName;
        protected System.Web.UI.WebControls.Label Message;

	public string PilotId;
        private void LoginBtn_Click(Object sender, ImageClickEventArgs e) {

        // Attempt to Validate User Credentials using PilotsDB
        // PilotsDB accountSystem = new PilotsDB();
        string PilotId = PilotLogin(FirstName.Text, LastName.Text);

		if ((PilotId  != null) && (PilotId  != "")) 
		{
			// Use security system to set the UserID within a client-side Cookie
			// FormsAuthentication.SetAuthCookie(email.Text, RememberCheckbox.Checked);

			//ASPNetPortal.PilotsDB Pilots = new ASPNetPortal.PilotsDB();
			SqlDataReader dr = GetSinglePilot(FirstName.Text, LastName.Text);
			// Read first row from database
			dr.Read();

			//Session["PilotID"] = System.Convert.ToInt32(dr["PilotID"]);
			Session["PilotsID"] = dr["PilotsID"];
			//PilotId = dr["PilotsID"];

			Server.Transfer("~/pbfpr/PilotReg.aspx");
			//Response.Redirect("http://planoballoonfest.org/pbfpr/PilotReg.aspx");

			dr.Close();

		}
		else 
		{
			Message.Text = "<" + "br" + ">Login Failed!" + "<" + "br" + ">";
		}

          }

                //*********************************************************************
		//
		// GetSinglePilot Method
		//
		// The GetSinglePilot method returns a SqlDataReader containing details
		// about a specific user from the Pilots database table.
		//
		//*********************************************************************

		public SqlDataReader GetSinglePilot(String FirstName, String LastName) 
		{

			// Create Instance of Connection and Command Object
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
			SqlCommand myCommand = new SqlCommand("GetSinglePilot", myConnection);

			// Mark the Command as a SPROC
			myCommand.CommandType = CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterFirstName = new SqlParameter("@FirstName", SqlDbType.NVarChar, 30);
			parameterFirstName.Value = FirstName;
			myCommand.Parameters.Add(parameterFirstName);

			SqlParameter parameterLastName = new SqlParameter("@LastName", SqlDbType.NVarChar, 30);
			parameterLastName.Value = LastName;
			myCommand.Parameters.Add(parameterLastName);

			// Open the database connection and execute the command
			myConnection.Open();
			SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

			// Return the datareader
			return dr;
		}

                //*********************************************************************
		//
		// PilotDB.Login() Method <a name="Login"></a>
		//
		// The Login method validates a email/password pair against credentials
		// stored in the users database.  If the email/password pair is valid,
		// the method returns user's name.
		//
		// Other relevant sources:
		//     + <a href="PilotsLogin.htm" style="color:green">PilotsLogin Stored Procedure</a>
		//
		//*********************************************************************

		public String PilotLogin(String FirstName, String LastName) 
		{

			// Create Instance of Connection and Command Object
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
			SqlCommand myCommand = new SqlCommand("PilotLogin", myConnection);

			// Mark the Command as a SPROC
			myCommand.CommandType = CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter parameterFirstName = new SqlParameter("@FirstName", SqlDbType.NVarChar, 30);
			parameterFirstName.Value = FirstName;
			myCommand.Parameters.Add(parameterFirstName);

			SqlParameter parameterLastName = new SqlParameter("@LastName", SqlDbType.NVarChar, 30);
			parameterLastName.Value = LastName;
			myCommand.Parameters.Add(parameterLastName);

			SqlParameter parameterPilotName = new SqlParameter("@PilotName", SqlDbType.NVarChar, 62);
			parameterPilotName.Direction = ParameterDirection.Output;
			myCommand.Parameters.Add(parameterPilotName);

			// Open the database connection and execute the command
			myConnection.Open();
			myCommand.ExecuteNonQuery();
			myConnection.Close();

			if ((parameterPilotName.Value != null) && (parameterPilotName.Value != System.DBNull.Value)) 
			{
				return ((String)parameterPilotName.Value).Trim();
			}
			else 
			{
				return String.Empty;
			}
		}

 }

</script>
<%--

   The SignIn User Control enables clients to authenticate themselves using 
   the ASP.NET Forms based authentication system.

   When a client enters their username/password within the appropriate
   textboxes and clicks the "Login" button, the LoginBtn_Click event
   handler executes on the server and attempts to validate their
   credentials against a SQL database.

   If the password check succeeds, then the LoginBtn_Click event handler
   sets the customers username in an encrypted cookieID and redirects
   back to the portal home page.

   If the password check fails, then an appropriate error message
   is displayed.

--%>
<P>
	<hr noshade size="1" width="98%">
	<span class="SubSubHead">
		<FONT face="Arial" size="4"><STRONG>If you have registered for previous year's events:</STRONG></FONT></span><STRONG><FONT face="Arial" size="4">
		</FONT></STRONG>
	<hr noshade size="1" width="98%">
<P></P>
<P>
	<span class="SubSubHead">
		<FONT face="Arial" size="4"><STRONG>Please sign-in for this year's event.</STRONG></FONT></span><STRONG><FONT size="4">
		</FONT></STRONG>
</P>
<P><STRONG><FONT size="4"></FONT></STRONG>Enter:
	<br>
	<FONT size="2">
		<span class="Normal">
			<STRONG><FONT face="Arial"><FONT size="3">First Name</FONT>:</FONT></STRONG></span>
		<br>
	</FONT>
	<asp:TextBox id="FirstName" columns="30" width="130" cssclass="NormalTextBox" runat="server" />
	<br>
	<FONT size="2"><FONT face="Arial">
			<span class="Normal">
				<STRONG><FONT size="3">Last Name</FONT>:</STRONG></span>
			<br>
		</FONT></FONT>
	<asp:TextBox id="LastName" columns="30" width="130" cssclass="NormalTextBox" runat="server" />
	<br>
	Then click on the log-in button.</P>
<!--
	<asp:checkbox id="RememberCheckbox" class="Normal" Text="Remember Login" runat="server" /></P>
	-->
<P>
	<table width="100%" cellspacing="0" cellpadding="4" border="0">
		<tr>
			<td>
				<asp:ImageButton id="SigninBtn" ImageUrl="~/images/login.gif" runat="server" />
				<br>
				<asp:label id="Message" class="NormalRed" runat="server" />
			</td>
		</tr>
	</table>
</P>
<hr noshade size="1" width="98%">
<span class="SubSubHead" style="HEIGHT:20px">
		<FONT face="Arial" size="4"><STRONG>If you have never registered and have been 
			invited to participate:</STRONG></FONT>
		<hr noshade size="1" width="98%">
		<br>
		<span class="SubSubHead" style="HEIGHT:20px">
		<FONT size="4"><STRONG>Please Register:</STRONG></FONT></span> Click on 
the&nbsp;register button.
		<br>
		<a href="Admin/Register.aspx"><img src="images/register.gif" border="0"></a>
		<hr noshade size="1" width="98%">
		<br>
	</span>

Open in new window

0
ronney_leslieCommented:
I need the whole code to debug this. Please post your aspx, aspx.cs, ascx.cs code.

Ronney
0
westdhAuthor Commented:

I need this to be inline code ...this signin function is not working right.
----------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0038: Cannot access a non-static member of outer type 'System.Web.UI.UserControl' via nested type 'ASP.desktopmodules_signin_ascx.Signin'

Source Error:

 

Line 48:
Line 49:                   //Session["PilotID"] = System.Convert.ToInt32(dr["PilotID"]);
Line 50:                   Session["PilotsID"] = dr["PilotsID"];
Line 51:                   //PilotId = dr["PilotsID"];
Line 52:
 

Source File: e:\hosting\member\planofest\pbfpr\DesktopModules\Signin.ascx    Line: 50
<%@ Control language="c#" AutoEventWireup="false" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.ComponentModel" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Caching" %>
<%@ Import Namespace="System.Web.SessionState" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Web.Security" %>

<script runat="server">

    public abstract class Signin 
   {
       		protected System.Web.UI.WebControls.ImageButton SigninBtn;
		protected System.Web.UI.WebControls.TextBox FirstName;
		protected System.Web.UI.WebControls.TextBox LastName;
        	protected System.Web.UI.WebControls.Label Message;
      
    
	public string PilotId;
        private void LoginBtn_Click(Object sender, ImageClickEventArgs e) 
        {

        //Attempt to Validate User Credentials using PilotsDB
        //PilotsDB accountSystem = new PilotsDB();

       		string PilotId = PilotLogin(FirstName.Text, LastName.Text);

		if ((PilotId  != null) && (PilotId  != "")) 
		{
			//Use security system to set the UserID within a client-side Cookie
			//FormsAuthentication.SetAuthCookie(email.Text, RememberCheckbox.Checked);

			//ASPNetPortal.PilotsDB Pilots = new ASPNetPortal.PilotsDB();
			SqlDataReader dr = GetSinglePilot(FirstName.Text, LastName.Text);
			//Read first row from database
			dr.Read();

			//Session["PilotID"] = System.Convert.ToInt32(dr["PilotID"]);
			Session["PilotsID"] = dr["PilotsID"];
			//PilotId = dr["PilotsID"];

			Server.Transfer("~/pbfpr/PilotReg.aspx");
			//Response.Redirect("http://planoballoonfest.org/pbfpr/PilotReg.aspx");

			dr.Close();

		}
		else 
		{
			Message.Text = "<" + "br" + ">Login Failed!" + "<" + "br" + ">";
		}

          }

        //*********************************************************************
	//
	// GetSinglePilot Method
	//
	// The GetSinglePilot method returns a SqlDataReader containing details
	// about a specific user from the Pilots database table.
	//
	//*********************************************************************

	public SqlDataReader GetSinglePilot(String FirstName, String LastName) 
	{

		// Create Instance of Connection and Command Object
		SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
		SqlCommand myCommand = new SqlCommand("GetSinglePilot", myConnection);

		// Mark the Command as a SPROC
		myCommand.CommandType = CommandType.StoredProcedure;

		// Add Parameters to SPROC
		SqlParameter parameterFirstName = new SqlParameter("@FirstName", SqlDbType.NVarChar, 30);
		parameterFirstName.Value = FirstName;
		myCommand.Parameters.Add(parameterFirstName);

		SqlParameter parameterLastName = new SqlParameter("@LastName", SqlDbType.NVarChar, 30);
		parameterLastName.Value = LastName;
		myCommand.Parameters.Add(parameterLastName);

		// Open the database connection and execute the command
		myConnection.Open();
		SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

		// Return the datareader
		return dr;
	}

        //*********************************************************************
        //
	// PilotDB.Login() Method <a name="Login"></a>
	//
	// The Login method validates a  pair against credentials
	// stored in the users database.  
	//*********************************************************************

	public String PilotLogin(String FirstName, String LastName) 
	{
		// Create Instance of Connection and Command Object
		SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
		SqlCommand myCommand = new SqlCommand("PilotLogin", myConnection);

		// Mark the Command as a SPROC
		myCommand.CommandType = CommandType.StoredProcedure;

		// Add Parameters to SPROC
		SqlParameter parameterFirstName = new SqlParameter("@FirstName", SqlDbType.NVarChar, 30);
		parameterFirstName.Value = FirstName;
		myCommand.Parameters.Add(parameterFirstName);

		SqlParameter parameterLastName = new SqlParameter("@LastName", SqlDbType.NVarChar, 30);
		parameterLastName.Value = LastName;
		myCommand.Parameters.Add(parameterLastName);

		SqlParameter parameterPilotName = new SqlParameter("@PilotName", SqlDbType.NVarChar, 62);
		parameterPilotName.Direction = ParameterDirection.Output;
		myCommand.Parameters.Add(parameterPilotName);

		// Open the database connection and execute the command
		myConnection.Open();
		myCommand.ExecuteNonQuery();
		myConnection.Close();

		if ((parameterPilotName.Value != null) && (parameterPilotName.Value != System.DBNull.Value)) 
		{
			return ((String)parameterPilotName.Value).Trim();
		}
		else 
		{
			return String.Empty;
	        }
        }

   }

</script>

   <%--
   The SignIn User Control enables clients to authenticate themselves using 
   the ASP.NET Forms based authentication system.

   When a client enters their username/password within the appropriate
   textboxes and clicks the "Login" button, the LoginBtn_Click event
   handler executes on the server and attempts to validate their
   credentials against a SQL database.

   If the password check succeeds, then the LoginBtn_Click event handler
   sets the customers username in an encrypted cookieID and redirects
   back to the portal home page.

   If the password check fails, then an appropriate error message
   is displayed.

   --%>
    <p>
	<hr noshade size="1" width="98%">
	<span class="SubSubHead">
		<FONT face="Arial" size="4"><STRONG>If you have registered for previous year's events:</STRONG></FONT></span><STRONG><FONT face="Arial" size="4">
		</FONT></STRONG>
	<hr noshade size="1" width="98%">
    <p></p>
    <p>
	<span class="SubSubHead">
		<FONT face="Arial" size="4"><STRONG>Please sign-in for this year's event.</STRONG></FONT></span><STRONG><FONT size="4">
		</FONT></STRONG>
    </p>
     <p><STRONG><FONT size="4"></FONT></STRONG>Enter:
	<br>
	<FONT size="2">
		<span class="Normal">
			<STRONG><FONT face="Arial"><FONT size="3">First Name</FONT>:</FONT></STRONG></span>
		<br>
	</FONT>
	<asp:TextBox id="FirstName" columns="30" width="130" cssclass="NormalTextBox" runat="server" />
	<br>
	<FONT size="2"><FONT face="Arial">
			<span class="Normal">
				<STRONG><FONT size="3">Last Name</FONT>:</STRONG></span>
			<br>
		</FONT></FONT>
	<asp:TextBox id="LastName" columns="30" width="130" cssclass="NormalTextBox" runat="server" />
	<br>
	Then click on the log-in button.</P>
        <!--
	<asp:checkbox id="RememberCheckbox" class="Normal" Text="Remember Login" runat="server" /></P>
	-->
     <p>
	<table width="100%" cellspacing="0" cellpadding="4" border="0">
		<tr>
			<td>
				<asp:ImageButton id="SigninBtn" ImageUrl="~/images/login.gif" runat="server" />
                                <br>
				<asp:label id="Message" class="NormalRed" runat="server" />
			</td>
		</tr>
	</table>
     </p>
     <hr noshade size="1" width="98%">
     <span class="SubSubHead" style="HEIGHT:20px">
		<FONT face="Arial" size="4"><STRONG>If you have never registered and have been 
			invited to participate:</STRONG></FONT>
		<hr noshade size="1" width="98%">
		<br>
		<span class="SubSubHead" style="HEIGHT:20px">
		<FONT size="4"><STRONG>Please Register:
                 Click on the register button.</STRONG></FONT></span>
		<br>
		<a href="Admin/Register.aspx"><img src="images/register.gif" border="0"></a>
		<hr noshade size="1" width="98%">
		<br>
      </span>

Open in new window

0
ronney_leslieCommented:
I have corrected your code and it should work now.

BTW:
I had a look at all your questions in EE and I realize that you had issues deploying dlls to Bin and hence resorted to single aspx or ascx pages without code behind (.cs) files.

Is that right?

The dll issue could have neem easily sorted out ort still you could have used .cs code behind files without dlls.

Ronney
<%@ Control language="c#" AutoEventWireup="false"   %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.ComponentModel" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Caching" %>
<%@ Import Namespace="System.Web.SessionState" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Web.Security" %>

<script runat="server">

   
   
      
    
	public string PilotId;
        public void LoginBtn_Click(Object sender, ImageClickEventArgs e) 
        {

        //Attempt to Validate User Credentials using PilotsDB
        //PilotsDB accountSystem = new PilotsDB();

       		string PilotId = PilotLogin(FirstName.Text, LastName.Text);

		if ((PilotId  != null) && (PilotId  != "")) 
		{
			//Use security system to set the UserID within a client-side Cookie
			//FormsAuthentication.SetAuthCookie(email.Text, RememberCheckbox.Checked);

			//ASPNetPortal.PilotsDB Pilots = new ASPNetPortal.PilotsDB();
			SqlDataReader dr = GetSinglePilot(FirstName.Text, LastName.Text);
			//Read first row from database
			dr.Read();

			//Session["PilotID"] = System.Convert.ToInt32(dr["PilotID"]);
			Session["PilotsID"] = dr["PilotsID"];
			//PilotId = dr["PilotsID"];

			Server.Transfer("~/pbfpr/PilotReg.aspx");
			//Response.Redirect("http://planoballoonfest.org/pbfpr/PilotReg.aspx");

			dr.Close();

		}
		else 
		{
			Message.Text = "<" + "br" + ">Login Failed!" + "<" + "br" + ">";
		}

          }

        //*********************************************************************
	//
	// GetSinglePilot Method
	//
	// The GetSinglePilot method returns a SqlDataReader containing details
	// about a specific user from the Pilots database table.
	//
	//*********************************************************************

	public SqlDataReader GetSinglePilot(String FirstName, String LastName) 
	{

		// Create Instance of Connection and Command Object
		SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
		SqlCommand myCommand = new SqlCommand("GetSinglePilot", myConnection);

		// Mark the Command as a SPROC
		myCommand.CommandType = CommandType.StoredProcedure;

		// Add Parameters to SPROC
		SqlParameter parameterFirstName = new SqlParameter("@FirstName", SqlDbType.NVarChar, 30);
		parameterFirstName.Value = FirstName;
		myCommand.Parameters.Add(parameterFirstName);

		SqlParameter parameterLastName = new SqlParameter("@LastName", SqlDbType.NVarChar, 30);
		parameterLastName.Value = LastName;
		myCommand.Parameters.Add(parameterLastName);

		// Open the database connection and execute the command
		myConnection.Open();
		SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

		// Return the datareader
		return dr;
	}

        //*********************************************************************
        //
	// PilotDB.Login() Method <a name="Login"></a>
	//
	// The Login method validates a  pair against credentials
	// stored in the users database.  
	//*********************************************************************

	public String PilotLogin(String FirstName, String LastName) 
	{
		// Create Instance of Connection and Command Object
		SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
		SqlCommand myCommand = new SqlCommand("PilotLogin", myConnection);

		// Mark the Command as a SPROC
		myCommand.CommandType = CommandType.StoredProcedure;

		// Add Parameters to SPROC
		SqlParameter parameterFirstName = new SqlParameter("@FirstName", SqlDbType.NVarChar, 30);
		parameterFirstName.Value = FirstName;
		myCommand.Parameters.Add(parameterFirstName);

		SqlParameter parameterLastName = new SqlParameter("@LastName", SqlDbType.NVarChar, 30);
		parameterLastName.Value = LastName;
		myCommand.Parameters.Add(parameterLastName);

		SqlParameter parameterPilotName = new SqlParameter("@PilotName", SqlDbType.NVarChar, 62);
		parameterPilotName.Direction = ParameterDirection.Output;
		myCommand.Parameters.Add(parameterPilotName);

		// Open the database connection and execute the command
		myConnection.Open();
		myCommand.ExecuteNonQuery();
		myConnection.Close();

		if ((parameterPilotName.Value != null) && (parameterPilotName.Value != System.DBNull.Value)) 
		{
			return ((String)parameterPilotName.Value).Trim();
		}
		else 
		{
			return String.Empty;
	        }
        }

   

</script>

   <%--
   The SignIn User Control enables clients to authenticate themselves using 
   the ASP.NET Forms based authentication system.

   When a client enters their username/password within the appropriate
   textboxes and clicks the "Login" button, the LoginBtn_Click event
   handler executes on the server and attempts to validate their
   credentials against a SQL database.

   If the password check succeeds, then the LoginBtn_Click event handler
   sets the customers username in an encrypted cookieID and redirects
   back to the portal home page.

   If the password check fails, then an appropriate error message
   is displayed.

   --%>
    <p>
	<hr noshade size="1" width="98%">
	<span class="SubSubHead">
		<FONT face="Arial" size="4"><STRONG>If you have registered for previous year's events:</STRONG></FONT></span><STRONG><FONT face="Arial" size="4">
		</FONT></STRONG>
	<hr noshade size="1" width="98%">
    <p></p>
    <p>
	<span class="SubSubHead">
		<FONT face="Arial" size="4"><STRONG>Please sign-in for this year's event.</STRONG></FONT></span><STRONG><FONT size="4">
		</FONT></STRONG>
    </p>
     <p><STRONG><FONT size="4"></FONT></STRONG>Enter:
	<br>
	<FONT size="2">
		<span class="Normal">
			<STRONG><FONT face="Arial"><FONT size="3">First Name</FONT>:</FONT></STRONG></span>
		<br>
	</FONT>
	<asp:TextBox id="FirstName" columns="30" width="130" cssclass="NormalTextBox" runat="server" />
	<br>
	<FONT size="2"><FONT face="Arial">
			<span class="Normal">
				<STRONG><FONT size="3">Last Name</FONT>:</STRONG></span>
			<br>
		</FONT></FONT>
	<asp:TextBox id="LastName" columns="30" width="130" cssclass="NormalTextBox" runat="server" />
	<br>
	Then click on the log-in button.</P>
        <!--
	<asp:checkbox id="RememberCheckbox" class="Normal" Text="Remember Login" runat="server" /></P>
	-->
     <p>
	<table width="100%" cellspacing="0" cellpadding="4" border="0">
		<tr>
			<td>
				<asp:ImageButton id="SigninBtn" ImageUrl="~/images/login.gif" runat="server" OnClick="LoginBtn_Click"  />
                                <br>
				<asp:label id="Message" class="NormalRed" runat="server" />
			</td>
		</tr>
	</table>
     </p>
     <hr noshade size="1" width="98%">
     <span class="SubSubHead" style="HEIGHT:20px">
		<FONT face="Arial" size="4"><STRONG>If you have never registered and have been 
			invited to participate:</STRONG></FONT>
		<hr noshade size="1" width="98%">
		<br>
		<span class="SubSubHead" style="HEIGHT:20px">
		<FONT size="4"><STRONG>Please Register:
                 Click on the register button.</STRONG></FONT></span>
		<br>
		<a href="Admin/Register.aspx"><img src="images/register.gif" border="0"></a>
		<hr noshade size="1" width="98%">
		<br>
      </span>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.