veri tabanı uygulaması

using System.Threading.Tasks;

using System.Data.OleDb;

 

Clas a ekle:

OleDbConnection con;

OleDbCommand cmd;

OleDbDataReader dr;


private void button1_Click(object sender, EventArgs e)

{

string ad = textBox1.Text;

string sifre = textBox2.Text;

con = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=okul.accdb");

cmd = new OleDbCommand();            con.Open();

cmd.Connection = con;

cmd.CommandText = "Select * from kullanici where StrComp(k_ad,'" + textBox1.Text + "',0)=0 and StrComp(k_pass,'" + textBox2.Text + "',0)=0";            // cmd.CommandText = "Select * from kullanici Where k_ad = '" + textBox1.Text + "' COLLATE SQL_Latin1_General_CS_AS and k_sifre  ='" + textBox2.Text + "' COLLATE SQL_Latin1_General_CS_AS";

dr = cmd.ExecuteReader();

if (dr.Read())      {

Form2 f2 = new Form2();

f2.Show();            }

else            {     MessageBox.Show("Kullanıcı adı ya da şifre yanlış");            }

con.Close();

Son değiştirme: 20 Aralık 2016, Salı, 17:27
Gezinme atla

Gezinme