A
A
Andrew Kolomiets2021-01-12 23:35:18
SQL
Andrew Kolomiets, 2021-01-12 23:35:18

Why does the output from two ms access tables in the datagrid not work?

I have this code, but for some reason it doesn't work.

string str = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + @"C:\Users\akolo\Desktop\База_данных.mdb";
            OleDbConnection dbcon = new OleDbConnection(str);
            OleDbDataAdapter da = new OleDbDataAdapter();
            DataSet ds = new DataSet();
            dbcon.Open();
            OleDbCommand d = new OleDbCommand("Select ФИО From Список_специалистов INNER JOIN ФИО ON Журнал_учёта_работ.id_Специалиста = Список_специалистов.id", dbcon);
            dbcon.Close();
            da.SelectCommand = d;
            da.Fill(ds);
            dataGridView1.DataSource = ds.Tables;
            da.Update(ds);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
idShura, 2021-01-13
@Coolam

You would at least write what is meant by the word "does not work." Shows an error or what?
In your sql query, the table name is incorrectly specified here INNER JOIN full name , but it should be INNER JOIN

Select ФИО 
  From Список_специалистов 
       INNER JOIN Журнал_учёта_работ ON Журнал_учёта_работ.id_Специалиста = Список_специалистов.id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question