C# Access Veritabanı ile Hasta Takip Programı - Bilişim Konuları

C# Access Veritabanı ile Hasta Takip Programı

Herhangi bir hastanede veya sağlık ocağında yada sağlık merkezinde bulunan hastaların her türlü bilgilerini kayıt altına alınması ve takibinin yapılması amacıyla hazırlanmış access veri tabanını kullanan bir program.

Merkezimizde bulunan hastaların bilgileri access veri tabanında yapılmaktadır. Veri tabanı üzerinde kayıt ekleme, kayıt silme, kayıt listeleme, kayıt arama ve kayıt güncelleme işlemleri yapılmaktadır.

Öncelikle veri tabanında bulunan tablonun alanlarını ve veri türlerini yazalım.

hasta-tablo

Yukarıdaki alanlardan ve veri türlerinde oluşan tabloyu oluşturduktan sonra form üzerinde istediğimiz gibi tasarım yapıp kodlamaya geçebiliriz.

Programla neler yapılabilir:

  1. Yeni kayıt ekleme: Yeni bir müşteri geldiğinde müşteri bilgilerini yazarak tabloya yeni bir kayıt ekleyebiliriz.
  2. Kayıt listeleme: Tabloda bulunan tüm kayıtları ekranda bir datagrid üzerinde listeleyebiliriz.
  3. Kayıt Arama: İstediğimiz herhangi bir kritere göre kayıt arama yaptırabiliriz. Aranan kayıt bulunduğunda tüm bilgileri ekrana getirilir.
  4. Kayıt Güncelleme: Tabloda bulunan herhangi bir kaydı bularak kayıt üzerinde istediğimiz gibi güncelleme işlemi yapabiliriz.
  5. Kayıt Silme: Veri tabanından istenilen bir kayıt bulunarak veri tabanından silme işlemi yapılabilir.

Programın ekran görüntüsü:

hasta-takip

Programın C# kodları:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;//Veri Tabanı Baglantı Kütüphanesi


namespace hasta_takip
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        //Veri Tabanı Değişkenlerini Tanımlama Bölümü
        OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=hasta.accdb");
        OleDbCommand komut = new OleDbCommand();
        OleDbDataAdapter adaptor = new OleDbDataAdapter(); DataSet tasima = new DataSet();
        string resimo;

        //DataGridWiev de kayıtları listeleme bölümü
        void listele()
        {
            baglanti.Open();
            OleDbDataAdapter adaptor = new OleDbDataAdapter("Select * from hasta", baglanti);
            adaptor.Fill(tasima, "hasta");
            dataGridView1.DataSource = tasima.Tables["hasta"];
            adaptor.Dispose();
            baglanti.Close();

        }
        private void Form1_Load(object sender, EventArgs e)
        {
            {
                listele();
            }
        }

        //RESİM EKLEME BÖLÜMÜ
        private void button7_Click(object sender, EventArgs e)
        {
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    pictureBox1.ImageLocation = openFileDialog1.FileName;
                    oresim.Text = openFileDialog1.FileName;
                }// "\" karakterinin ascii kodunu alma bölümü
                int s = 92;
                string harf = ((char)s).ToString();
                // Resmin adresinin tersten yazdırama bölümü
                string yazi = oresim.Text; string metin = "";
                int yaziuzunlugu = yazi.Length;
                for (int i = yaziuzunlugu; i > 0; i--)
                {
                    if (yazi.Substring(i - 1, 1) == harf)
                    {
                        break;
                    }
                    metin = metin + (yazi.Substring(i - 1, 1));
                }
                // Bulunan resim adını düzden yazdırma bölümü
                int uzunluk = metin.Length; string kelime = "";
                for (int a = uzunluk; a > 0; a--)
                {
                    kelime = kelime + (metin.Substring(a - 1, 1));
                }
                //resim adını oresim kutusuna yazdırma bölümü
                oresim.Text = "Resim/" + kelime;
                resimo = oresim.Text;
            }
        }

        private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            h_id.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            h_tc.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            h_adi.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            h_soyadi.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            h_telefonu.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
            h_mail.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            h_adresi.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();
            h_yatis_tarihi.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString();
            h_cikis_tarihi.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString();
            h_ilac.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString();
            h_teshis.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString();
            h_ucret.Text = dataGridView1.CurrentRow.Cells[11].Value.ToString();

            pictureBox1.ImageLocation = dataGridView1.CurrentRow.Cells[12].Value.ToString();
            oresim.Text = dataGridView1.CurrentRow.Cells[12].Value.ToString();
        }
        //yeni kayıt ekleme
        private void button4_Click(object sender, EventArgs e)
        {
            h_id.Text = "";
            h_tc.Text = "";
            h_adi.Text = "";
            h_soyadi.Text = "";
            h_telefonu.Text = "";
            h_mail.Text = "";
            h_adresi.Text = "";
            h_yatis_tarihi.Text = "";
            h_cikis_tarihi.Text = "";
            h_ilac.Text = "";
            h_teshis.Text = "";
            h_ucret.Text = "";

            pictureBox1.ImageLocation = "";
            oresim.Text = "";
        }
        //kayıt ekleme
        private void button5_Click(object sender, EventArgs e)
        {
            oresim.Text = pictureBox1.ImageLocation;
            if (h_tc.Text != "" && h_adi.Text != "" && h_soyadi.Text != "" && h_telefonu.Text != "" && h_mail.Text != "" && h_adresi.Text != "" && h_yatis_tarihi.Text != "" && h_cikis_tarihi.Text != "" && h_ilac.Text != "" && h_teshis.Text != "" && h_ucret.Text != "" && oresim.Text != "")
            {
            komut.Connection = baglanti;
            komut.CommandText = "Insert Into hasta(h_tc,h_adi,h_soyadi,h_telefonu,h_mail,h_adresi,h_yatis_tarihi,h_cikis_tarihi,h_ilac,h_teshis,h_ucret,h_resim) Values ('" + h_tc.Text + "','" + h_adi.Text + "','" + h_soyadi.Text + "','" + h_telefonu.Text + "','" + h_mail.Text + "','" + h_adresi.Text + "','" + h_yatis_tarihi.Text + "','" + h_cikis_tarihi.Text + "','" + h_ilac.Text + "','" + h_teshis.Text + "','" + h_ucret.Text + "','" + resimo + "')";
            baglanti.Open();
            komut.ExecuteNonQuery();
            komut.Dispose();
            baglanti.Close();
            MessageBox.Show("Kayıt Tamamlandı!");
            tasima.Clear();
            listele();
            }
            else
            {
            MessageBox.Show("Boş alan geçmeyiniz!");
            }
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            baglanti = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=hasta.accdb");
            adaptor = new OleDbDataAdapter("Select * from hasta where h_id like '%" + textBox2.Text + "%'", baglanti);
            tasima = new DataSet();
            baglanti.Open();
            adaptor.Fill(tasima, "hasta");
            dataGridView1.DataSource = tasima.Tables["hasta"];
            baglanti.Close();
        }
        //kayıt silme
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult c;
            c = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (c == DialogResult.Yes)
            {
                baglanti.Open();
                komut.Connection = baglanti;
                komut.CommandText = "Delete from hasta where h_id=" + textBox1.Text + "";
                komut.ExecuteNonQuery();
                komut.Dispose();
                baglanti.Close();
                tasima.Clear();
                listele();
            }
        }

        //kayıt güncelleme
        private void button6_Click(object sender, EventArgs e)
        {

            komut = new OleDbCommand();
            baglanti.Open();
            komut.Connection = baglanti;
            komut.CommandText = "update hasta set h_tc='" + h_tc.Text + "', h_adi='" + h_adi.Text + "', h_soyadi='" + h_soyadi.Text + "', h_telefonu='" + h_telefonu.Text + "', h_mail='" + h_mail.Text + "', h_adresi='" + h_adresi.Text + "', h_yatis_tarihi='" + h_yatis_tarihi.Text + "', h_cikis_tarihi='" + h_cikis_tarihi.Text + "', h_ilac='" + h_ilac.Text + "', h_teshis='" + h_teshis.Text + "', h_ucret='" + h_ucret.Text + "', h_resim='" + oresim.Text + "' where h_id=" + h_id.Text + "";
            komut.ExecuteNonQuery();
            baglanti.Close();
            tasima.Clear();
            listele();

        }
    }
}

C# Access Veri Tabanı İle Yapılmış Diğer Proje Örnekleri



C# access veri tabanı ile araba kiralama programı

C# access veri tabanı ile demirbaş takip programı

C# access veri tabanı ile eczane programı

C# access veri tabanı ile emlakçı programı

C# access veri tabanı ile hal takip programı

C# access veri tabanı ile kullanıcı girişi programı

C# access veri tabanı ile kütüphane programı

C# access veri tabanı ile otel oda programı

C# access veri tabanı ile oto galeri programı

C# access veri tabanı ile otopark programı

C# access veri tabanı ile veresiye takip programı

C# access veri tabanı ile araç kiralama programı

C# access veri tabanı ile demirbaş takip programı

C# access veri tabanı ile eczane takip programı

C# access veri tabanı ile emlakçı programı

C# access veri tabanı ile futbolcu kayıt programı

C# access veri tabanı ile hasta takip programı

C# access veri tabanı ile işçi takip programı

C# access veri tabanı ile kitap kayıt programı

C# access veri tabanı ile kütüphane programı

C# access veri tabanı ile otel müşteri programı

C# access veri tabanı ile otel takip programı

C# access veri tabanı ile otopark programı

C# access veri tabanı ile telefon satış programı

C# access veri tabanı ile muhtar takip programı

C# access veri tabanı ile veresiye takip programı

C# access veri tabanı ile kayıt ekleme, silme, listeleme, arama, güncelleme

Bu Yazıya Tepkin Nedir?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Yorum Yap

9 Yorum