Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 132,358 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,179 people online right now. Registration is fast and FREE... Join Now!




to create login form

 
Reply to this topicStart new topic

to create login form, in this even when im wrinting correct username n password it is displa

mamtabaghel
post 30 Aug, 2008 - 07:55 PM
Post #1


New D.I.C Head

*
Joined: 30 Aug, 2008
Posts: 6



Thanked 1 times
My Contributions


CODE

private void button1_Click(object sender, EventArgs e)  
        {  
            string username;  
            string password;  
  
            if (textBox1.Text="")  
            {  
                if (textBox1.Text ="")  
                {  
                    Form1 myform = new Form1();  
                    myform.Close();  
                }  
                else  
                {  
                    Application.Exit();  
                }  
            }  


}


i want that if i click submit button after filling username n password it should compare wid database to see if it is valid user and allow it to go next page.
plz help me
User is offlineProfile CardPM

Go to the top of the page

mamtabaghel
post 30 Aug, 2008 - 08:48 PM
Post #2


New D.I.C Head

*
Joined: 30 Aug, 2008
Posts: 6



Thanked 1 times
My Contributions


CODE

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            bool blnfound=false;
            string con="Data Source=.;Initial Catalog=club;Integrated Security=True";
            SqlConnection cn=new SqlConnection(con);
            cn.Open();
            SqlCommand cmd=new SqlCommand("select * from login",cn);
            SqlDataReader dr=cmd.ExecuteReader();
            while(dr.Read())
             {
    
              if(dr["username"].ToString()==textBox1.Text)
                  {
                     if (dr["Password"].ToString().ToString() ==textBox2.Text)
                     {
                        blnfound = true;
                     }
                  }
             }
            if(!blnfound)
            MessageBox.Show("Wrong login info is provided");
                 dr.Close();
                 cn.Close();
           }
    }



User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 30 Aug, 2008 - 08:52 PM
Post #3


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,923



Thanked 118 times

Dream Kudos: 8475

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Please do not create duplicate topics. Also, please put your question or problem in the body of your post and not in the comments sesion. The comments section holds on a certain number of characters so it's getting cut off and we have no idea what your question/ problem is.

Topics merged smile.gif


User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 04:18AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month