Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralRe: Issue with App Settings (Settings.setting & user.config) and version info Pin
GenJerDan26-Mar-11 14:08
GenJerDan26-Mar-11 14:08 
QuestionGmail inbox retrive Pin
Md. Shamiul Islam Hiron25-Mar-11 12:52
Md. Shamiul Islam Hiron25-Mar-11 12:52 
AnswerRe: Gmail inbox retrive Pin
shivamkalra25-Mar-11 13:38
shivamkalra25-Mar-11 13:38 
GeneralRe: Gmail inbox retrive Pin
Keith Barrow25-Mar-11 13:47
professionalKeith Barrow25-Mar-11 13:47 
AnswerRe: Gmail inbox retrive Pin
Keith Barrow25-Mar-11 13:45
professionalKeith Barrow25-Mar-11 13:45 
GeneralRe: Gmail inbox retrive Pin
shivamkalra26-Mar-11 7:42
shivamkalra26-Mar-11 7:42 
AnswerRe: Gmail inbox retrive Pin
Ganesh Kumar Kaki13-Apr-11 2:51
Ganesh Kumar Kaki13-Apr-11 2:51 
Questionget HTML elements with C# in ASP.NET Pin
msqar25-Mar-11 9:51
msqar25-Mar-11 9:51 
Hi community, i'm needing some help with C# and ASP.NET, mostly C# that's why i posted here.
I got this form in my login.aspx.

<form id="login_form" action="" method="post">
     <label>Email:</label>
     <label>Password:</label>
     <input type="text" name="login_email" id="login_email" />
     <input type="password" name="login_password" id="login_password" />
     <button id="login_button" type="submit">Login</button>
     <a href="#">¿Forgot password?</a>                
</form>


And also i added a database with the SQL EXPRESS.
I got the login.aspx.cs with this code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Sql;
using System.Data.SqlClient;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    private void login_button(object sender, EventArgs e)
    {

        SqlConnection connection = new SqlConnection();
        connection.ConnectionString = "Server=(local)\\SQLEXPRESS;" + "user ID=myuser; Password=mypassword;" + "Database=mydatabase";

        try
        {
            connection.Open();
           
        }
        catch (Exception)
        {
           //Not connecting
        }

        
    }
}


Now the question is, how can i get HTML elements with the C#, so then i make the "SELECT Email, Password FROM tblUsers WHERE Email='input_user" AND Password='input_password'" being input_user and input_password C# strings.
login_button is the ID of the submit button in ASP.NET.

How do i join all this? Getting the number of rows after making the query, like in PHP when you make the $row = sql_query("WHERE...") and returns the number of rows, if $rows == "1", it means that the pair "email and password" exists, so login access is granted.

Thanks for everything!

Hope you can help me!

Marian.
AnswerWrong Forum Pin
Keith Barrow25-Mar-11 13:51
professionalKeith Barrow25-Mar-11 13:51 
QuestionWhat is the mistake with this code??? Pin
shivamkalra25-Mar-11 7:34
shivamkalra25-Mar-11 7:34 
AnswerRe: What is the mistake with this code??? Pin
Luc Pattyn25-Mar-11 7:44
sitebuilderLuc Pattyn25-Mar-11 7:44 
GeneralRe: What is the mistake with this code??? Pin
shivamkalra25-Mar-11 7:57
shivamkalra25-Mar-11 7:57 
GeneralRe: What is the mistake with this code??? Pin
Luc Pattyn25-Mar-11 8:12
sitebuilderLuc Pattyn25-Mar-11 8:12 
GeneralRe: What is the mistake with this code??? Pin
shivamkalra25-Mar-11 8:28
shivamkalra25-Mar-11 8:28 
GeneralRe: What is the mistake with this code??? Pin
Dev. RoOo725-Mar-11 19:36
Dev. RoOo725-Mar-11 19:36 
AnswerRe: What is the mistake with this code??? Pin
David198725-Mar-11 7:57
David198725-Mar-11 7:57 
AnswerRe: What is the mistake with this code??? Pin
Luc Pattyn25-Mar-11 8:09
sitebuilderLuc Pattyn25-Mar-11 8:09 
GeneralRe: What is the mistake with this code??? Pin
David198725-Mar-11 8:11
David198725-Mar-11 8:11 
AnswerRe: What is the mistake with this code??? Pin
Dave Kreskowiak25-Mar-11 8:16
mveDave Kreskowiak25-Mar-11 8:16 
AnswerRe: What is the mistake with this code??? Pin
BobJanova30-Mar-11 23:58
BobJanova30-Mar-11 23:58 
Questionpowerpoint Pin
om_metab25-Mar-11 7:17
om_metab25-Mar-11 7:17 
AnswerRe: powerpoint Pin
Luc Pattyn25-Mar-11 7:38
sitebuilderLuc Pattyn25-Mar-11 7:38 
Questioncombbobox fild saving Pin
Pierre besquent25-Mar-11 1:16
Pierre besquent25-Mar-11 1:16 
AnswerRe: combbobox fild saving Pin
Not Active25-Mar-11 1:20
mentorNot Active25-Mar-11 1:20 
GeneralRe: combbobox fild saving Pin
Pierre besquent25-Mar-11 2:37
Pierre besquent25-Mar-11 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.