Click here to Skip to main content
16,014,860 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: hell urgent Pin
Baconbutty7-Oct-10 2:02
Baconbutty7-Oct-10 2:02 
QuestionWait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . [modified] Pin
cmaheshwari165-Oct-10 19:31
cmaheshwari165-Oct-10 19:31 
AnswerRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
Vimalsoft(Pty) Ltd5-Oct-10 21:50
professionalVimalsoft(Pty) Ltd5-Oct-10 21:50 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
cmaheshwari165-Oct-10 22:58
cmaheshwari165-Oct-10 22:58 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
Murugesan G6-Oct-10 0:56
Murugesan G6-Oct-10 0:56 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
cmaheshwari166-Oct-10 1:40
cmaheshwari166-Oct-10 1:40 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
Murugesan G6-Oct-10 1:48
Murugesan G6-Oct-10 1:48 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
cmaheshwari166-Oct-10 2:26
cmaheshwari166-Oct-10 2:26 
hi ,
how to connect to the database and how to provide the GUI as I said that i dont have VS.
Please cant u favour me just give me some hint for login only ...
also below please find my login coding...

login.aspx.cs

protected void btnLogin_Click(object sender, EventArgs e)<br />
    {<br />
        if (Session["Admin"] != null)<br />
        {<br />
            if (txtPassword.Text.ToUpper.Equals(Session["Admin"]))<br />
                Response.Redirect("Homepage.aspx");<br />
        }<br />
        String except = null;<br />
        <big>DataValidation dv = new DataValidation();</big>        String pass = txtPassword.Text;<br />
<br />
        String password = null;<br />
        <br />
        password = dv.loginIn(txtUserName.Text);<br />
        <br />
        if (password==null)<br />
        {<br />
            //Session["Exception"] = except;<br />
            Session["SourceFile"] = Formname;<br />
            Response.Redirect("Error.aspx");<br />
            txtUserName.Text = "Exception";<br />
        }<br />
<br />
        else if (password.Equals(pass))<br />
        {<br />
            //txtUserName.Text = "Success";<br />
            Session["User"] = txtUserName.Text;<br />
            if (Session["User"].ToString().ToUpper().Equals("ADMIN"))<br />
                Session["Admin"] = "ADMIN";<br />
            Response.Redirect("Homepage.aspx");<br />
<br />
        }<br />
        <br />
        else <br />
        {<br />
            lblCheck.Text="Invalid UserName or Password";<br />
            //Response.Redirect("LogIn.aspx");<br />
        }<br />
<br />
<br />
<br />
    }


the DataValidation function[this is one .cs file i have maintained for data validation]

public String loginIn(String userName)<br />
    {<br />
        String queryBuilder;<br />
        <br />
        {<br />
            DataBaseConnection ds = new DataBaseConnection();<br />
<br />
            queryBuilder = "SELECT Password FROM User_Master WHERE UserName = @uname";<br />
<br />
            String pass = ds.loginDataBase(userName, queryBuilder);<br />
<br />
            return pass;<br />
        }<br />
<br />
    }



the DataBase connection function


SqlConnection getConnection()<br />
    {<br />
        SqlConnection cn = null;                <br />
        {<br />
            cn = new SqlConnection();            <br />
            cn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();<br />
            return cn;                     <br />
        }<br />
    }<br />
<br />
<br />
<br />
    public String loginDataBase(String userName, String queryBuilder)<br />
    {<br />
        SqlConnection sqlcon = null;<br />
        try<br />
        {<br />
            sqlcon = new SqlConnection();<br />
            sqlcon.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();<br />
            sqlcon.Open();<br />
<br />
            SqlCommand cmd = new SqlCommand();<br />
<br />
            cmd.CommandText = queryBuilder;<br />
            cmd.CommandType = CommandType.Text;<br />
            cmd.Connection = sqlcon;<br />
<br />
            cmd.Parameters.AddWithValue("@uname", userName);            <br />
           <br />
            SqlDataReader dr = cmd.ExecuteReader();<br />
            if (dr.HasRows == true)<br />
            {<br />
                dr.Read();<br />
                return dr[0].ToString();<br />
            }<br />
            else<br />
                return null;<br />
           <br />
        }<br />
<br />
        catch (Exception ex)<br />
        {<br />
            //except = ex.ToString();<br />
            return null;<br />
        }<br />
        finally<br />
        {<br />
            sqlcon.Close();<br />
        }<br />
    }

GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
Murugesan G6-Oct-10 3:34
Murugesan G6-Oct-10 3:34 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
cmaheshwari166-Oct-10 4:06
cmaheshwari166-Oct-10 4:06 
GeneralRe: Wait it looks same but its diff read the problem:- how to connect the ASP.NET with sql server 2005 express edition . Pin
Murugesan G6-Oct-10 4:08
Murugesan G6-Oct-10 4:08 
QuestionUnit test cases for Web Services Pin
indian1435-Oct-10 7:56
indian1435-Oct-10 7:56 
AnswerRe: Unit test cases for Web Services Pin
Keith Barrow5-Oct-10 10:29
professionalKeith Barrow5-Oct-10 10:29 
GeneralRe: Unit test cases for Web Services Pin
indian1435-Oct-10 11:07
indian1435-Oct-10 11:07 
GeneralRe: Unit test cases for Web Services Pin
Keith Barrow5-Oct-10 11:54
professionalKeith Barrow5-Oct-10 11:54 
GeneralRe: Unit test cases for Web Services Pin
indian1436-Oct-10 9:06
indian1436-Oct-10 9:06 
GeneralRe: Unit test cases for Web Services Pin
Keith Barrow6-Oct-10 10:06
professionalKeith Barrow6-Oct-10 10:06 
AnswerRe: Unit test cases for Web Services Pin
Luc Pattyn5-Oct-10 11:34
sitebuilderLuc Pattyn5-Oct-10 11:34 
GeneralRe: Unit test cases for Web Services Pin
indian1435-Oct-10 11:59
indian1435-Oct-10 11:59 
GeneralRe: Unit test cases for Web Services Pin
Luc Pattyn5-Oct-10 12:06
sitebuilderLuc Pattyn5-Oct-10 12:06 
GeneralRe: Unit test cases for Web Services Pin
Keith Barrow5-Oct-10 12:38
professionalKeith Barrow5-Oct-10 12:38 
QuestionShort key for proeject in Solution Explorer Pin
indian1435-Oct-10 5:27
indian1435-Oct-10 5:27 
QuestionNOOB Question: using LIKE in SelectParameter Pin
Figmo25-Oct-10 4:48
Figmo25-Oct-10 4:48 
AnswerRe: NOOB Question: using LIKE in SelectParameter Pin
Electron Shepherd5-Oct-10 5:06
Electron Shepherd5-Oct-10 5:06 
AnswerUse Parameterized queires Pin
David Mujica5-Oct-10 5:13
David Mujica5-Oct-10 5:13 

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.