Welcome to Dream.In.Code
Become an Expert!

Join 149,951 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,327 people online right now. Registration is fast and FREE... Join Now!




login page

 
Reply to this topicStart new topic

login page, i have designed login page and using stored procedure

alwalchandu
10 Sep, 2008 - 02:02 AM
Post #1

New D.I.C Head
*

Joined: 10 Sep, 2008
Posts: 2



Thanked: 1 times
My Contributions
CODE
try
        {
            if (sqlCon.State == ConnectionState.Closed)
            {
                sqlCon.Open();
            }

            SqlDataReader objReader;
            objReader = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
            while (objReader.Read())
            {
                if ((string)objReader.GetValue(0) != "1")
                {
                    lblmessage1.Text = "Invalid login!";
                    //return false;
                }
                else
                {
                    objReader.Close();
                    return true;

                }


            }
        }


        catch (Exception ex)
        {
            lblmessage2.Text = "Error Connecting to the database";
        }
    }
}

----------------------------
error
--------
Compiler Error Message: CS0127: Since 'login.btnLogin_Click(object, System.EventArgs)' returns void, a return keyword must not be followed by an object expression

Source Error:



Line 103: {
Line 104: objReader.Close();
Line 105: return true;
Line 106:
Line 107: }
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: Login Page
10 Sep, 2008 - 03:14 AM
Post #2

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 579



Thanked: 16 times
Dream Kudos: 575
My Contributions
Error message clearly says everything. You can't return a value inside a button event's sub. So remove true from return true;

Please use Code Tags while posting code.
Example: code.gif
User is offlineProfile CardPM
+Quote Post

alwalchandu
RE: Login Page
10 Sep, 2008 - 08:50 PM
Post #3

New D.I.C Head
*

Joined: 10 Sep, 2008
Posts: 2



Thanked: 1 times
My Contributions
QUOTE(dineeshd @ 10 Sep, 2008 - 04:14 AM) *

Error message clearly says everything. You can't return a value inside a button event's sub. So remove true from return true;

Please use Code Tags while posting code.
Example: code.gif

thanks for the reply but it is not working
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Login Page
10 Sep, 2008 - 09:37 PM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
So what error message are you getting now?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 05:40PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month