OK, here is the business part of my master page
Now I have the default.aspx page
and then the default.aspx.cs page
I have a connection string in the web.config file called YCMConnect and I get no errors but it doesn't hit the redirect and I am unsure how to use the Dataset to see if the entered login info matches what is in the db. Do I need to use a SqlDataReader? Is my existing code incorrect or inefficient? I have gone thru many tutorials and I just feeling like I am missing this one last piece to finally bring it together. Maybe?
thanks for any help you can give me!
Willie
Code:
<form runat="server">
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</form>
Now I have the default.aspx page
Code:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<div id="content-wrap">
<div id="content-inside">
<h1>Registration</h1>
Username:<br />
<asp:TextBox ID="username" runat="server"></asp:TextBox>
<br />
Password:<br />
<asp:TextBox ID="password" runat="server" TextMode="Password"></asp:TextBox>
<br />
<input type="image" name="submit" id="Button1_Click" src="[URL unfurl="true"]https://secure.ycmhome.org/images/submit_blue.gif"[/URL] onmouseover='this.src="[URL unfurl="true"]https://secure.ycmhome.org/images/submit_green.gif"';[/URL] onmouseout='this.src="[URL unfurl="true"]https://secure.ycmhome.org/images/submit_blue.gif"';[/URL] value="Submit >>" />
<p></p>
If you've forgotten your username/password or are not sure if your church has an account, <a href="checkprofiles.aspx">click here</a>.
</div>
</div>
</asp:Content>
and then the default.aspx.cs page
Code:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
private SqlConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string connstr = ConfigurationManager.ConnectionStrings["YCMConnect"].ConnectionString;
conn = new SqlConnection(connstr);
string selectstatement = "SELECT login FROM logins WHERE login='" + username.Text + "' and pwd='" + password.Text + "'";
SqlCommand selectCommand = new SqlCommand(selectstatement, conn);
SqlDataAdapter productsDataAdapter = new SqlDataAdapter(selectCommand);
DataSet productsDataSet = new DataSet();
Response.Redirect("logon.aspx");
}
}
I have a connection string in the web.config file called YCMConnect and I get no errors but it doesn't hit the redirect and I am unsure how to use the Dataset to see if the entered login info matches what is in the db. Do I need to use a SqlDataReader? Is my existing code incorrect or inefficient? I have gone thru many tutorials and I just feeling like I am missing this one last piece to finally bring it together. Maybe?
thanks for any help you can give me!
Willie