Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private void LoadData()
           sql_cmd = sql_con.CreateCommand();
           string CommandText = "SELECT Rents.Name, Rents.Brand_Model_Plate_Number, Rents.rental_date,Rents.return_date,Car.rate,Payment.charges FROM Rents INNER JOIN Car ON Rents.rental_id = Car.car_id INNER JOIN Payment ON Rents.rental_id = Payment.payment_id; ";
           DB = new SQLiteDataAdapter(CommandText, sql_con);
           DT = DS.Tables[0];
           dgvBills.DataSource = DT;


it only show the column name but no data

What I have tried:

tried different joins and sql statement but to no avail
Updated 1-Apr-22 20:03pm

1 solution

If it shows no data, that's because your JOIN is failing to produce any rows.
This code works for me:
string strConnect = SMDBSupport.SMInstanceStorage.GetInstanceConnectionString("MyDBName");
using (SQLiteConnection con = new SQLiteConnection(strConnect))
        using (SQLiteDataAdapter da = new SQLiteDataAdapter(getCount, con))
            using (DataTable dt = new DataTable())
                myDataGridView.DataSource = dt;
    catch (Exception ex)
It's literally my boilerplate code for a DataAdapter to a DataGridView for SQLite (it's drag'n'dropped from the VS Toolbox into my code ready to fill in!)

So ... use the debugger to find out exactly what is happening - and that any exception isn't being swallowed - then use SSMS or similar to open the SQLite DB and check exactly what in in your DB and what results your SELECT returns.

Sorry, but we can't do that for you!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900