Jump to content

[Çözüldü]Executenonquery Sorunu Aliyorum


yakupnun
 Share

Recommended Posts

Çözdüm insert into kullanırken bir tana , fazladan koymuşum başlık nasıl sılınır bil miyorum adminler silebilirler gereksiz yer işgal etmesin.

merhabalar acces veri tabanına birşeyler eklameya calışıyorum öğrenme amaçlı. kodum bu

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 acces_veri_tabanı
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        OleDbConnection baglantı = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Kişiler.mdb");
        private void VerileriGörüntüle()
        {
            listView1.Items.Clear();
            baglantı.Open();
            OleDbCommand komut = new OleDbCommand ();
            komut.Connection = baglantı;
            komut.CommandText = ("SELECT * from Bilgiler");
            OleDbDataReader oku = komut.ExecuteReader();
            while (oku.Read())
            {
                ListViewItem ekle = new ListViewItem();
                ekle.Text = oku["Ad"].ToString();
                ekle.SubItems.Add(oku["Soyad"].ToString());
                ekle.SubItems.Add(oku["Yaş"].ToString());
                ekle.SubItems.Add(oku["İlçe"].ToString());

                listView1.Items.Add(ekle);
                
            }
            baglantı.Close();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            VerileriGörüntüle();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            baglantı.Open();
            OleDbCommand komut = new OleDbCommand("inset into Bilgiler (Ad,Soyad,Yaş,İlçe) values ('" + textBox1.Text.ToString() + "','" + textBox2.Text.ToString() + "','" + textBox3.Text.ToString() + "','" + textBox4.Text.ToString() + "',)", baglantı);
            komut.ExecuteNonQuery();
            baglantı.Close();
            VerileriGörüntüle();
        }
    }
}

yalnız listeleme yapabiliyorum ama kaydet tuşunu tıkladığımda program şu hatayı veriyor hata.png yardımcı olabilirseniz sevinirim.

Edited by yakupnun
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...