TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Zrnko Kávy
NA
20
403
(using SQLite) DataGridView showing only three rows from my DB
Dec 6 2020 11:22 PM
Hey there.. after days of trying to solve this problem by trying some variations of my code,
I'm desperate.
I'm trying to fill my DataGridView with SQLite database - it works.. but..
DatGridView shows me only a few rows
, for whatever reason.
additional info:
SQLite queries work perfectly (tried in "DB Browser in SQLite")
also tried UNION/UNION ALL and cmd.ExecuteReader/cmd.ExecuteNonQuery + cmd.ExecuteReader
code:
private
void
button1_Click(
object
sender, EventArgs e)
{
SQLiteConnection myconnection =
new
SQLiteConnection(
"Data Source=C:\\Users\\jprochazka\\Desktop\\HG DB SQLite\\hg_db07 - serverside\\hg_db06\\databaze_heinz_glas.db;Version=3"
);
myconnection.Open();
SQLiteCommand cmd =
new
SQLiteCommand();
cmd.Connection = myconnection;
cmd.CommandText =
"SELECT id, nazev_tabulky, nazev_zarizeni, typ_zarizeni, vyrobce, umisteni, evidencni_cislo FROM Spotrebice UNION "
+
"SELECT id, nazev_tabulky, nazev_zarizeni, typ_zarizeni, vyrobce, umisteni, evidencni_cislo FROM Stroje UNION "
+
"SELECT id, nazev_tabulky, prurez, typ_kabelu, vyrobce, umisteni, evidencni_cislo FROM Prodluzovaci_Privody UNION "
+
"SELECT id, nazev_tabulky, nazev, oznaceni, vnejsi_vlivy, null, ev_c FROM Prostory UNION "
+
"SELECT id, nazev_tabulky, oznaceni, typ_zarizeni, vyrobce, umisteni, vyrobni_cislo FROM Rozvadece;"
;
using
(SQLiteDataReader sdr = cmd.ExecuteReader())
{
DataTable dt =
new
DataTable();
dt.Load(sdr);
sdr.Close();
myconnection.Close();
dataGridView1.DataSource = dt;
}
}
Thanks for every advice.
Reply
Answers (
4
)
Get Data Multiple Table.
XLSTransformer equivalent in .Net