Windows forms application ile access veritabanı arasında bağlantı yapmaya çalışıyorum fakat hata alıyorum hatayı veren kod bloğum ;
private void button1_Click(object sender, EventArgs e)
{
baglanti.Open();
OleDbCommand hastayatir = new OleDbCommand("Insert INTO Hastalar(TC Kimlik No,Hasta Adı,Hasta Soyadı,Geldiği Poliklinik,Geldiği Tarih,Geldiği Saat,Oda No) VALUES ('" + textBox1.Text + " ',' " + textBox2.Text + " ',' " + textBox3.Text + " ',' " + textBox4.Text + " ',' " + textBox5.Text + " ',' " + textBox6.Text + " ',' " + textBox7.Text + " ')",baglanti);
hastayatir.ExecuteNonQuery();
MessageBox.Show("Hasta Kaydı Başarılı.");
baglanti.Close();
}
aldığım hata syntax error Insert Into Statement
bağlantıyı tanımladığım yer burası ;
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=Hastalar.accdb");
private void button1_Click(object sender, EventArgs e)
{
baglanti.Open();
OleDbCommand hastayatir = new OleDbCommand("Insert INTO Hastalar(TC Kimlik No,Hasta Adı,Hasta Soyadı,Geldiği Poliklinik,Geldiği Tarih,Geldiği Saat,Oda No) VALUES ('" + textBox1.Text + " ',' " + textBox2.Text + " ',' " + textBox3.Text + " ',' " + textBox4.Text + " ',' " + textBox5.Text + " ',' " + textBox6.Text + " ',' " + textBox7.Text + " ')",baglanti);
hastayatir.ExecuteNonQuery();
MessageBox.Show("Hasta Kaydı Başarılı.");
baglanti.Close();
}
aldığım hata syntax error Insert Into Statement
bağlantıyı tanımladığım yer burası ;
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=Hastalar.accdb");