gokseldede93
Öğrenci
- Katılım
- 1 Nisan 2009
- Mesajlar
- 13
- Reaksiyon puanı
- 0
- Puanları
- 1
Personel takibiyle ilgili program yazıyorum ancak kayıt bölmünde hata veriyor . Bana çok acil hatalarımı söyleyebilecek birisi var mı çok acil yetiştirmem gerekli çözüm bulamadım..
Kod
Kod
Kod:
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 PersonelTakipSistemi
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
public string resimsakla;
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openDialog = new OpenFileDialog();
openDialog.Filter = "Resim dosyaları |*.jpg;*.jpeg;*.gif;*.bmp;" +
"*.png;*ico|JPEG Files ( *.jpg;*.jpeg )|*.jpg;*.jpeg|GIF Files ( *.gif )|*.gif|BMP Files ( *.bmp )" +
"|*.bmp|PNG Files ( *.png )|*.png|Icon Files ( *.ico )|*.ico";
openDialog.Title = "Resim seçiniz.";
openDialog.InitialDirectory = Application.StartupPath + @"\\DataPicture\";
if (openDialog.ShowDialog() == DialogResult.OK)
{
resimsakla = openDialog.FileName.ToString();
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.ImageLocation = resimsakla;
}
openDialog.Dispose();
//try
//{
// pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
// pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
//}
//catch { }
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void comboboxagetir()
{
string baglantı,sorgu;
baglantı = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=personel.mdb";
sorgu = "SELECT * FROM bolum";
OleDbConnection yeni = new OleDbConnection(baglantı);
OleDbCommand veri = new OleDbCommand(sorgu,yeni);
OleDbDataReader oku;
yeni.Open();
oku = veri.ExecuteReader();
while (oku.Read())
{
comboBox3.Items.Add(oku["Bolum_Adi"].ToString());
}
oku.Close();
yeni.Close();
}
private void comboboxgetir()
{
string baglantı, sorgu;
baglantı = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=personel.mdb";
sorgu = "SELECT * FROM gorev";
OleDbConnection yeni = new OleDbConnection(baglantı);
OleDbCommand veri = new OleDbCommand(sorgu, yeni);
OleDbDataReader oku;
yeni.Open();
oku = veri.ExecuteReader();
while (oku.Read())
{
comboBox2.Items.Add(oku["Gorev_Adi"].ToString());
}
oku.Close();
yeni.Close();
}
private void comboboxverigetir()
{
string baglantı, sorgu;
baglantı = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=personel.mdb";
sorgu = "SELECT * FROM ogrenim";
OleDbConnection yeni = new OleDbConnection(baglantı);
OleDbCommand veri = new OleDbCommand(sorgu, yeni);
OleDbDataReader oku;
yeni.Open();
oku = veri.ExecuteReader();
while (oku.Read())
{
comboBox1.Items.Add(oku["Egitim"].ToString());
}
oku.Close();
yeni.Close();
}
private void comboehliyet()
{
string baglantı, sorgu;
baglantı = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=personel.mdb";
sorgu = "SELECT * FROM ehliyet";
OleDbConnection yeni = new OleDbConnection(baglantı);
OleDbCommand veri = new OleDbCommand(sorgu, yeni);
OleDbDataReader oku;
yeni.Open();
oku = veri.ExecuteReader();
while (oku.Read())
{
comboBox4.Items.Add(oku["cins"].ToString());
}
oku.Close();
yeni.Close();
}
private void Kancombo()
{
string baglantı, sorgu;
baglantı = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=personel.mdb";
sorgu = "SELECT * FROM kan";
OleDbConnection yeni = new OleDbConnection(baglantı);
OleDbCommand veri = new OleDbCommand(sorgu, yeni);
OleDbDataReader oku;
yeni.Open();
oku = veri.ExecuteReader();
while (oku.Read())
{
comboBox5.Items.Add(oku["KanGrubu"].ToString());
}
oku.Close();
yeni.Close();
}
OleDbConnection baglanti = new OleDbConnection();
DataTable dt = new DataTable();
BindingSource bs = new BindingSource();
DataTable dt_personel = new DataTable();
BindingSource bs_personel = new BindingSource();
OleDbCommand SorguCalistir;
OleDbDataReader SorguSonucu;
string sorgu, islem;
private void Form4_Load(object sender, EventArgs e)
{
bs.DataSource = dt;
//dataGridView1.DataSource = bs;
bs_personel.DataSource = dt_personel;
baglanti.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=personel.mdb";
sorgu = "select * from Personel";
bilgi_al();
comboboxagetir();
comboboxgetir();
comboboxverigetir();
comboehliyet();
Kancombo();
}
private void bilgi_al()
{
SorguCalistir = new OleDbCommand(sorgu, baglanti);
baglanti.Open();
SorguSonucu = SorguCalistir.ExecuteReader();
dt.Clear();
dt.Load(SorguSonucu);
baglanti.Close();
}
private void checkBox5_CheckedChanged(object sender, EventArgs e)
{
}
private void checkBox6_CheckedChanged(object sender, EventArgs e)
{
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
comboboxgetir();
}
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
comboboxagetir();
}
private void yeniToolStripMenuItem1_Click(object sender, EventArgs e)
{
Form11 frm11 = new Form11();
frm11.ShowDialog();
}
private void güncelleToolStripMenuItem_Click(object sender, EventArgs e)
{
Form11 frm11 = new Form11();
frm11.ShowDialog();
}
private void silToolStripMenuItem_Click(object sender, EventArgs e)
{
Form11 frm11 = new Form11();
frm11.ShowDialog();
}
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
{
comboehliyet();
}
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
{
Kancombo();
}
private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void baskıÖnizlemeToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void button2_Click_1(object sender, EventArgs e)
{
sorgu = string.Format("insert into Personel (Sicil_No,Adi,Soyadi,Tc_Kimlik_No,Dogum_Yeri,Dogum_Tarihi,Medeni_Durum,tel_no,Ev_Adresi,ehliyet_id,ögrenim_id,kan_id,Saglik_Sorunu,bolum_id,gorev_id,Ise_Giris_Tarihi,Isten_Cikis_Tarihi,Calisma_Durumu) Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')", textBox1.Text, textBox3.Text, textBox4.Text, textBox2.Text, textBox11.Text,dateTimePicker1.Value,comboBox7.SelectedValue.ToString(),maskedTextBox1.Text,textBox5.Text,comboBox4.SelectedValue.ToString(),comboBox1.SelectedValue.ToString(),comboBox5.SelectedValue.ToString(),textBox7.Text,comboBox3.SelectedValue.ToString(),comboBox2.SelectedValue.ToString(),dateTimePicker2.Value,dateTimePicker3.Value,comboBox6.SelectedValue.ToString());
SorguCalistir = new OleDbCommand(sorgu, baglanti);
baglanti.Open();
SorguCalistir.ExecuteNonQuery();
baglanti.Close();
sorgu = "select * from Personel";
bilgi_al();
MessageBox.Show("Veriler Başarı ile Kaydedildi..");
}
private void button3_Click_1(object sender, EventArgs e)
{
}
private void textBox16_TextChanged(object sender, EventArgs e)
{
}
private void comboBox4_SelectedIndexChanged_1(object sender, EventArgs e)
{
comboehliyet();
}
}
}