Login Form Yapımı

6 06 2009

Merhaba arkadaşlar…

Hepimizin ortak bi derdine çözüm olmak ve yeni açtığım Blog sayfamda yararlı olacağına inandığım için .NET C Sharp’da Login sayfası oluşturmaktan bahsedeceğim.  Bütün projelerimiz için ilk adım ….

private void btn_login_Click(object sender, EventArgs e)
{
try

{
SqlConnection myConnection = new SqlConnection(“Data Source=.;Initial Catalog=Test1;Integrated Security=True”); myConnection.Open();
SqlCommand myCommand = new SqlCommand(“SELECT Owner_Name,Password FROM Owner WHERE Owner_Name = ‘” + txt_username.Text + “‘ AND Password = ‘” + txt_password.Text + “‘”, myConnection);
SqlDataReader myReader = myCommand.ExecuteReader();
if (txt_username.Text != “” && txt_password.Text != “”)
{
if (myReader.Read())
{

Main frm = new Main();
frm.ShowDialog();
this.Hide();
myConnection.Close();
}
else
{

MessageBox.Show(“Wrong User Name or Password !”, “Warning”, MessageBoxButtons.OK, MessageBoxIcon.Warning);
txt_username.Clear();
txt_password.Clear();
}
}
else
{
MessageBox.Show(“Please, Fill all neccessary fields.”, “Warning”, MessageBoxButtons.OK,MessageBoxIcon.Warning);
myConnection.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
myConnection.Close();
Application.Exit();
}

}


İşlemler

Bilgi

Bir cevap

2 01 2011
2010 in review « Osman MARANGOZ

[...] Login Form Yapımı June 2009 3 [...]

Yorum yapın

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Değiştir )

Twitter picture

You are commenting using your Twitter account. Log Out / Değiştir )

Facebook photo

You are commenting using your Facebook account. Log Out / Değiştir )

Connecting to %s




Follow

Get every new post delivered to your Inbox.