🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Burak HABER / C# / 90. Veri Tabanlı Admin Girişi

1-) C# - 90. Veri Tabanlı Admin Girişi

mssql new table



Edit top 200 rows





TxtSifre>>Properties>>UseSystemPasswordChar>>True

Solution explorer ana giriş ekranı

{

            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new frmgiris());

        }

new form=frmgiris.cs


using System;

using System.Windows.Forms;

using System.Data.SqlClient;

 

namespace Personel_kayit

{

    public partial class frmgiris : Form

    {

        public frmgiris()

        {

            InitializeComponent();

        }

        SqlConnection baglanti = new SqlConnection("Data Source=DESKTOP-9BC05PL;Initial Catalog=PersonelVeriTabani;User Id=sa;Password=123456;Integrated Security=True");//kopyalanmış databaseyi yapıştırıyoruz.

 

        private void BtnGirisYap_Click(object sender, EventArgs e)

        {

            baglanti.Open();

            SqlCommand komut = new SqlCommand("select * from tbl_yonetici where kullaniciad=@p1 and sifre=@p2", baglanti);

            komut.Parameters.AddWithValue("@p1", TxtKullancıAd.Text);

            komut.Parameters.AddWithValue("@p2", TxtSifre.Text);

            SqlDataReader dr = komut.ExecuteReader();

            if (dr.Read())

            {

                FrmAnaForm frm = new FrmAnaForm();

                frm.Show();

                this.Hide();

            }

            else

            {

                MessageBox.Show("Hatalı Kullanıcı Adı ya da Şifre");

            }

 

            baglanti.Close();

        }

    }

}

 

 2021 Mart 11 Perşembe
 393