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 Finisar.SQLite;
using FirebirdSql.Data.FirebirdClient;

namespace CSRehber
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
TableYukle();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void label1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = "";
}

private void button7_Click(object sender, EventArgs e)
{

string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

string sorgu = "Select * from rehber";

// FbConnection dbcon = new FbConnection(baglanti);

FbCommand cmb = new FbCommand(sorgu, dbcon);

FbDataAdapter fbda = new FbDataAdapter(sorgu, dbcon);

DataSet dt = new DataSet();

fbda.Fill(dt, "rehber");

// textBox1.Text = fbda.ItemArray.GetValue(0).ToString;

try
{

MessageBox.Show("besmele");
dbcon.Open();
}
catch (Exception Ex)
{
MessageBox.Show("inna lillah");
}
finally
{
dbcon.Close();
}

 

}

private void button5_Click(object sender, EventArgs e)
{

string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

FbCommand komut;

komut = new FbCommand("insert into rehber(KNO,ADSOYAD,TELEFON,ADRES)values (@KNO,@ADSOYAD,@TELEFON,@ADRES)", dbcon);

dbcon.Open();
komut.Parameters.AddWithValue("@KNO", textBox1.Text);
komut.Parameters.AddWithValue("@ADSOYAD", textBox2.Text);
komut.Parameters.AddWithValue("@TELEFON", textBox3.Text);
komut.Parameters.AddWithValue("@ADRES", textBox4.Text);
komut.ExecuteNonQuery();
// MessageBox.Show("TAYIT TAMAM!");
dbcon.Close();
TableYukle();
}


private void button6_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void button4_Click(object sender, EventArgs e)
{
string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

// FbCommand komut = new FbCommand("Select * from rehber where kno=" + Convert.ToInt32(textBox1.Text), dbcon);
FbCommand komut = new FbCommand("Select * From rehber where KNO=('" + textBox1.Text + "')", dbcon);

try
{

dbcon.Open();
FbDataReader dr = komut.ExecuteReader();

if (dr.Read())
{
textBox1.Text = dr["kno"].ToString();
textBox2.Text = dr["adsoyad"].ToString();
textBox3.Text = dr["telefon"].ToString();
textBox4.Text = dr["adres"].ToString();
}

}
catch (Exception ex)
{
throw ex;
}
finally
{
dbcon.Close();
}


}

private void button2_Click(object sender, EventArgs e)
{

string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

try
{
dbcon.Open();

FbTransaction addDetailsTransaction = dbcon.BeginTransaction();

string SQLCommandText = "INSERT INTO rehber(kno,adsoyad,telefon,adres) VALUES ('" +
textBox1.Text + "','" +
textBox2.Text + "','" +
textBox3.Text + "','" +
textBox4.Text + "')";

FbCommand addDetailsCommand = new FbCommand(SQLCommandText, dbcon, addDetailsTransaction);

addDetailsCommand.ExecuteNonQuery();

addDetailsTransaction.Commit();
MessageBox.Show(" Kayıt Eklendi");
}
catch (Exception x)
{
MessageBox.Show(x.Message);
}


}

private void button8_Click(object sender, EventArgs e)
{

}

private void button3_Click(object sender, EventArgs e)
{

string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);
FbCommand komut = new FbCommand("delete from rehber where kno=" + Convert.ToInt32(textBox1.Text), dbcon);
dbcon.Open();
komut.ExecuteNonQuery();
dbcon.Close();

TableYukle();
}

void TableYukle()
{
string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

string sorgu = "Select * from rehber";

FbCommand cmb = new FbCommand(sorgu, dbcon);

FbDataAdapter fbda = new FbDataAdapter(sorgu, dbcon);

DataSet ds = new DataSet();

ds.Clear();
fbda.Fill(ds, "rehber");
dataGridView1.DataSource = ds.Tables["rehber"];
fbda.Dispose();

}
private void button9_Click(object sender, EventArgs e)
{


string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

string adsoy = textBox5.Text;

try
{
if (comboBox1.Text == "KNO")
{
FbCommand komut = new FbCommand("Select * from rehber where kno=" + textBox5.Text, dbcon);
dbcon.Open();
FbDataReader dr = komut.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr["kno"].ToString();
textBox2.Text = dr["adsoyad"].ToString();
textBox3.Text = dr["telefon"].ToString();
textBox4.Text = dr["adres"].ToString();
}

}

if (comboBox1.Text == "ADI SOYADI")
{
// MessageBox.Show("Mesajın İçeriği!", "Uyarı");

// FbCommand komut = new FbCommand("Select * from rehber where(adsoyad like '%" + adsoy + "%' )", dbcon);
FbCommand komut = new FbCommand("Select * From rehber where adsoyad=('" + textBox5.Text + "')", dbcon);

dbcon.Open();
FbDataReader dr = komut.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr["kno"].ToString();
textBox2.Text = dr["adsoyad"].ToString();
textBox3.Text = dr["telefon"].ToString();
textBox4.Text = dr["adres"].ToString();
}

}
if (comboBox1.Text == "TELEFON")
{
// MessageBox.Show("Mesajın İçeriği!", "Uyarı");

// FbCommand komut = new FbCommand("Select * from rehber where(adsoyad like '%" + adsoy + "%' )", dbcon);
FbCommand komut = new FbCommand("Select * From rehber where telefon=('" + textBox5.Text + "')", dbcon);

dbcon.Open();
FbDataReader dr = komut.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr["kno"].ToString();
textBox2.Text = dr["adsoyad"].ToString();
textBox3.Text = dr["telefon"].ToString();
textBox4.Text = dr["adres"].ToString();
}

}

}
catch (Exception ex)
{
throw ex;
}
finally
{
dbcon.Close();
}


}

private void button8_Click_1(object sender, EventArgs e)
{
string baglanti = "Database=C:\\ADRES.FDB;" + "User=SYSDBA;" + "Password=masterkey;" + "Dialect=3;" + "Server=localhost";
FbConnection dbcon = new FbConnection(baglanti);

FbCommand komut = new FbCommand("UPDATE rehber set adsoyad=@adsoyad,telefon=@telefon,ADRES=@ADRES WHERE kno='" + textBox1.Text + "'", dbcon);

dbcon.Open();
komut.Parameters.AddWithValue("@kno", textBox1.Text);
komut.Parameters.AddWithValue("@adsoyad", textBox2.Text);
komut.Parameters.AddWithValue("@telefon", textBox3.Text);
komut.Parameters.AddWithValue("@adres", textBox4.Text);
komut.ExecuteNonQuery();
dbcon.Close();
TableYukle();
}

private void button10_Click(object sender, EventArgs e)
{


}

}
}

 

Okul Zil Programı

yilsoftzil

9786059223690
logo5

Esma-ül Hüsna

Ziyaretçi İstatistikleri

Bugün14
Dün458
Bu hafta1860
Bu ay8332
Hepsi983052