Is there a way to customize the columns of List created with SQL using BindingSource and dataGridView?

44 views Asked by At

I am making a windows app that generates words with the letters the user enters. I use a database with 50k words. For each word, I compare the letters entered by the user with the number of letters in the Table and filter the word according to its suitability. To make it more understandable, I will show the row of a word in the table below. https://i.stack.imgur.com/qgyM9.png Since I compare all the rows in the table, I have to say "select * from table" in the SQL command, so I cannot customize the column there. I want only Word to appear as a column in the dataGridView. I indicate it in the image below. I tried using BindingSource.Filter but failed. https://i.stack.imgur.com/EOsnv.png

I am sharing the code part of the app that I have a problem with.

namespace kelimeApp
{
    public partial class Form1 : Form
    {
        BindingSource kelimesBindingSource = new BindingSource();
        List<Kelime> kelimes = new List<Kelime>();

        public Form1()
        {
            InitializeComponent();            
        }
        private void button1_Click(object sender, EventArgs e)
        {
            AlbumsDAO albumsDAO = new AlbumsDAO();

            kelimes = albumsDAO.getAllKelimes(textBox1.Text, textBox2.Text,
                textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text, textBox8.Text, textBox9.Text, textBox10.Text, Convert.ToInt32(birNUD.Value), Convert.ToInt32(ikiNUD.Value), Convert.ToInt32(ucNUD.Value), birHarfTB.Text, ikiHarfTB.Text, ucHarfTB.Text);

            kelimesBindingSource.DataSource = kelimes;                        
            dataGridView1.DataSource = kelimesBindingSource;                                
        }

        
    }
}
namespace kelimeApp
{
    public class Kelime
    {
        public int ID { get; set; }

        public String Word { get; set; }

        public int Length { get; set; }

        public int A { get; set; }
        ...
        ...
        public int Z { get; set; }
0

There are 0 answers