using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database3.mdb");
private void Form1_Load(object sender, EventArgs e)
{
listele();
}
DataTable tablo = new DataTable();
private void listele()
{
baglanti.Open();
OleDbDataAdapter adtr=new OleDbDataAdapter("select *from kayitbilgileri",baglanti);
adtr.Fill(tablo);
dataGridView1.DataSource = tablo;
baglanti.Close();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
baglanti.Open();
OleDbCommand komut = new OleDbCommand("insert into kayitbilgileri(@Kullanıcı,@Şifre) values('"+ textBox1.Text +"','"+ textBox2.Text +"'", baglanti);
komut.ExecuteNonQuery();
baglanti.Close();
MessageBox.Show("Kayıt başarıyla oluşturuldu.", "Kayıt");
for (int i = 0; i < Controls.Count; i++)
{
if (Controls[i] is TextBox)
{
Controls[i].Text = "";
}
}
}
}
}