C# Form Application - Insert Delete Update and Search in MS Access Database with Sample DB File

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 47

  • @raduluchian7008
    @raduluchian7008 2 года назад +2

    Thanks to the suggestions that appear for the next clip, the area where you write "dv.RowFilter = "NameFirstname LIKE ... ;" is covered.
    So please complete this line of code here.
    Thank you in advance!

    • @raduluchian7008
      @raduluchian7008 2 года назад +1

      That's what I did and it's not ok:
      dv.RowFilter = "lastName LIKE '%"+txtLastNume.Text+"%'";
      Where am I wrong?
      Again, I can't see your entire line because of the windows that pop up to suggest the other tutorials.

    • @TKcode
      @TKcode  2 года назад +1

      @@raduluchian7008 DataView dv = dt.DefaultView;
      dv.RowFilter = "Name LIKE '%" + txtSearch.Text + "%'";
      dgwCustomers.DataSource = dv;

    • @TKcode
      @TKcode  2 года назад

      DataView dv = dt.DefaultView;
      dv.RowFilter = "Name LIKE '%" + txtSearch.Text + "%'";
      dgwCustomers.DataSource = dv;

    • @Mysticalsword5
      @Mysticalsword5 2 года назад

      @@TKcode What if I have two fields for First name (Fname) and Last name (Lname)?

  • @unknow5600
    @unknow5600 7 месяцев назад

    adam ya aga bir türlü çözemediğim ve çözümünü bulamadığım şey bu kadar basitmiş sen adamsın tek sorun any cpu da çalışmasıymış deliricektim

  • @Orionpaxx723
    @Orionpaxx723 10 месяцев назад +1

    ı couldnt get the data from x64 file because it is not exist .

  • @ayeshamishree
    @ayeshamishree Год назад +2

    I am having error "Microsoft ACE OleDb.16.0 is not registered on the local machine". please help me I have to submit project in university. I have changed any CPU to Configuration, same as you did, but still its showing an error.

    • @liahimmihail5819
      @liahimmihail5819 Год назад

      I have the same problem, did you find a solution?

    • @ayeshamishree
      @ayeshamishree Год назад

      @@liahimmihail5819 yes! I have made this application.

    • @sharina2849
      @sharina2849 Год назад

      @@liahimmihail5819 Make sure you put everything in C file to avoid data confusion

  • @nikolas276
    @nikolas276 Год назад

    adapter.Fill(dt); not working(

  • @OggyOggy-n8n
    @OggyOggy-n8n 4 месяца назад

    Please tell me how about code Search Number or ID

  • @lwiimbokasweshi
    @lwiimbokasweshi 2 года назад +1

    When was dgwCustomers created? @ 4:38

    • @lwiimbokasweshi
      @lwiimbokasweshi 2 года назад +2

      Okay got it. It's the name of the grid

  • @MMiranda3
    @MMiranda3 2 года назад +1

    Please provide the codes to filter data in data grid view. Thanks. Unable to view the codes on this video. Thanks.

    • @raduluchian7008
      @raduluchian7008 2 года назад

      Hi,
      Did someone answer your request? Because I would have the same problem.

    • @raduluchian7008
      @raduluchian7008 2 года назад

      If it's still useful, I'll send you the solution in my case.
      So, it looks like this:
      DataView dv = dt.DefaultView;
      dv.RowFilter = "NameFirstName LIKE '" + txtSearchEmployee.Text + "%'";
      dgvEmployees.DataSource = dv;

  • @meowmeowwwwwwehsg
    @meowmeowwwwwwehsg Год назад

    mine is having a syntax error in update statement, someone pls?

  • @WILLFACTOR11
    @WILLFACTOR11 2 года назад

    hello, my update button dopesnt work it says, System.Data.OleDb.OleDbException: 'No value given for one or more required parameters.' anyhelp?

  • @tradetkm
    @tradetkm 2 года назад

    Merhaba hocam benimki insertte hata veriyor. Hep yazdigimda o hatayi aliyor. "mismatch of data types in the selection condition expression" neden ?

    • @TKcode
      @TKcode  2 года назад

      Veri uyuşmazlığı sorun sanırım

    • @tradetkm
      @tradetkm 2 года назад

      @@TKcode Veriyi alabiliyor sadece insert veya update almiyor bende

    • @ac6014
      @ac6014 2 года назад

      @@tradetkm int, double vb kayıt yapıyorsan çevirmek gerekiyor. Convert.ToInt32(..) gibi

  • @momusicph9304
    @momusicph9304 Год назад

    How about if you have two colums being search at the same time in the textbox? like for example we have first name and last name. What is the proper way to do it?

    • @TKcode
      @TKcode  Год назад +1

      Hello, If understood you true. There are a few different ways to handle searching for data in a textbox across multiple columns in a DataGridView in a Windows Forms application, but one common approach is to use the DataView.RowFilter property.
      First, you would need to create a DataView object for the DataTable or DataSet that is being displayed in the DataGridView. Then, you can use the DataView's RowFilter property to filter the data based on the text entered in the textbox and the column names of the first name and last name columns.
      Here's an example of how you might set the RowFilter property in a button click event handler
      private void searchButton_Click(object sender, EventArgs e)
      {
      string searchText = searchTextBox.Text;
      string filter = "(firstName LIKE '%" + searchText + "%') OR (lastName LIKE '%" + searchText + "%')";
      DataView dv = new DataView(yourDataTable);
      dv.RowFilter = filter;
      dataGridView1.DataSource = dv;
      }

    • @momusicph9304
      @momusicph9304 Год назад

      @@TKcode I want to ask some. I think this will work if you have only one textbox intended for typing keyword as such as searchText. right? what if you have two textbox intended for searching namely "First name" and "Last Name", how do I approach that? i dont know how to do it right. this is my sample code but it only reads the last line of code which is the last name. thankyouu in advanced.
      private void btnSearch_Click(object sender, EventArgs e)
      {
      DataView dv = dt.DefaultView;
      dv.RowFilter = "FIRST_NAME LIKE '%" + txtSearch.Text + "%'";
      dv.RowFilter = "LAST_NAME LIKE '%" + txtSearch2.Text + "%'";
      dgwVaccinee.DataSource = dv;

      }

    • @TKcode
      @TKcode  Год назад

      @@momusicph9304
      private void txtSearch_TextChanged(object sender, EventArgs e)
      {
      DataView dv = dt.DefaultView;
      dv.RowFilter = "Name + Country LIKE '%" + txtSearch.Text + "%'";
      dgwCustomers.DataSource = dv;
      }
      The filter is set using a combination of the "Name" and "Country" columns, and the search criteria is taken from the Text property of a TextBox (txtSearch). The filter uses the LIKE operator to match any rows where the combination of the "Name" and "Country" columns contains the search criteria as a substring.

    • @momusicph9304
      @momusicph9304 Год назад +1

      @@TKcode i have solved my problem. thankyouu so much for this! godbless!

  • @338madison
    @338madison 6 месяцев назад

    THANK YOU SO MUCH, DUDE

  • @ferhatokuyan7658
    @ferhatokuyan7658 2 года назад

    Projelerin %90 aynı ID yazmak zorundamıyız. ID otomatik artsın.

    • @TKcode
      @TKcode  2 года назад +3

      Bir veritabanında, bir kaydı birbirinden ayırt etmek için, genellikle Birincil Anahtar olarak bilinen benzersiz bir tanımlayıcıya ihtiyaç duyarız. Burada ki Id alanı otomatik artan olarak ayarlanmış. Yani benzersiz olması sağlanmış durumda. Benzersiz bir alanın olması tablolar arası ilişki kurma, güncelleme, silme gibi konularda kolaylık sağlar. Mesela bu örnekte Id alanına göre silme ve güncelleme işlemi yapılıyor. Örneğin isme göre silme işlemi gerçekleştirmek istersek adı John olan kaydı sil dediğimizde varsa tüm John isimli kayıtlar silinecektir.

  • @mohammedaminetniouni8816
    @mohammedaminetniouni8816 Год назад +1

    thank you so much !

  • @MaxBarylko
    @MaxBarylko 2 года назад

    omg im so grateful... this video helped me a lot

  • @GameShorts484
    @GameShorts484 Год назад +1

    Bilgisayarı şarja tak

  • @libertalia1561
    @libertalia1561 2 года назад

    Neden Türkçe anlatımı yok

  • @georgihristov2553
    @georgihristov2553 Год назад

    help
    System.Data.OleDb.OleDbException: 'Syntax error in INSERT INTO statement.'
    string query = "INSERT INTO data (tik, nk, top, np, tipo, npo, na, ka, kp, dp, dpo) VALUES" +
    "(@tik, @nk, @top, @np, @tipo, @npo, @na, @ka, @kp, @dp, @dpo)";
    cmd = new OleDbCommand(query, conn);
    cmd.Parameters.AddWithValue("@tik", textBox6.Text);
    cmd.Parameters.AddWithValue("@nk", maskedTextBox1.Text);
    cmd.Parameters.AddWithValue("@top", textBox2.Text);
    cmd.Parameters.AddWithValue("@np", maskedTextBox2.Text);
    cmd.Parameters.AddWithValue("@tipo", textBox3.Text);
    cmd.Parameters.AddWithValue("@npo", maskedTextBox3.Text);
    cmd.Parameters.AddWithValue("@na", textBox4.Text);
    cmd.Parameters.AddWithValue("@ka", textBox5.Text);
    cmd.Parameters.AddWithValue("@kp", maskedTextBox4.Text);
    cmd.Parameters.AddWithValue("@dp", dateTimePicker1.Text);
    cmd.Parameters.AddWithValue("@dpo", dateTimePicker2.Text);
    conn.Open();
    cmd.ExecuteNonQuery();
    conn.Close();
    MessageBox.Show("data inserted.");
    GetCustomers();

    • @tabiosluisfranco5657
      @tabiosluisfranco5657 Год назад

      SAME PROBLEM IM HAVING

    • @yojieazenila7239
      @yojieazenila7239 Год назад

      string query = "INSERT INTO data (tik, nk, top, np, tipo, npo, na, ka, kp, dp, [dpo]) VALUES" +
      "(@tik, @nk, @top, @np, @tipo, @npo, @na, @ka, @kp, @dp, @dpo)";
      I add this [ ] and it work i don't know to others , GL

    • @yojieazenila7239
      @yojieazenila7239 Год назад

      by the way Thanks , I'm so lazy to type so I copy this