public partial class Form1 : Form
{
SqlConnection baglan = new SqlConnection(@"Data Source=Corsix-x;Initial Catalog=database;Integrated Security=True");
DataTable tablo = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter();
SqlCommand komut = new SqlCommand();
DataSet dset = new DataSet();
public Form1()
{
InitializeComponent();
}
**** listele()
{
tablo.Clear();
baglan.Open();
SqlDataAdapter sda = new SqlDataAdapter("Select * from kullanici ",baglan);
sda.Fill(tablo);
sda.Dispose();
baglan.Close();
}
private **** button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" && textBox2.Text == "" && textBox3.Text == "" && textBox4.Text == "")
{
MessageBox.Show("İlgili Alanları Doldurunuz");
}
else if(textBox1.Text=="")
{
MessageBox.Show("Kullanıcı Adı Giriniz");
}
else if(textBox2.Text=="")
{
MessageBox.Show("Şifre Giriniz");
}
else
{
baglan.Open();
komut.Connection=baglan;
komut.CommandText="INSERT INTO kullanici(kadi,sifre,sifre2,gizli)VALUES('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"','"+textBox4.Text+"')";
komut.ExecuteNonQuery();
baglan.Close();
listele();
MessageBox.Show("Kaydınız Tamamlandı","Kayıt Başarılı",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
Form2 frm2=new Form2();
frm2.Show();
}