<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[no connection with qsqlite]]></title><description><![CDATA[<p dir="auto">Hello, I'm new to the forum and I hope you can help me.</p>
<p dir="auto">I successfully created my first form with QDesigner in python3  and then wanted to connect to my SQLite database.</p>
<p dir="auto">What I have done wrong ? I use SQlite 3.3.3 and pyside6-6.2.3</p>
<pre><code>from PySide6.QtWidgets import QApplication,QMainWindow
from PySide6 import QtSql
from QT.frm_main import Ui_frm_main


class Frm_main(QMainWindow, Ui_frm_main):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        mod_offene_Leistungen = QtSql.QSqlRelationalTableModel()
        mod_offene_Leistungen.setTable("Leistungen")
        mod_offene_Leistungen.select()
        self.tbl_offene_Leistungen.setModel(mod_offene_Leistungen)


db=QtSql.QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName("Rechnungen.db")



app=QApplication()
frm_main=Frm_main()
frm_main.show()
app.exec()

</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/36b43209-9eb5-4e86-a1e3-c11b3155870f.jpg" alt="Bild 22.02.22 um 18.28.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/134553/no-connection-with-qsqlite</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 09:09:30 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/134553.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Feb 2022 17:12:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to no connection with qsqlite on Thu, 24 Feb 2022 16:39:41 GMT]]></title><description><![CDATA[<p dir="auto">I rewrote the code again and now it works somehow... Thanks anyway to everyone</p>
]]></description><link>https://forum.qt.io/post/704158</link><guid isPermaLink="true">https://forum.qt.io/post/704158</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Thu, 24 Feb 2022 16:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Thu, 24 Feb 2022 15:21:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/704112">no connection with qsqlite</a>:</p>
<blockquote>
<p dir="auto"><a href="https://doc.qt.io/qt-5/qsqldatabase.html#lastError" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qsqldatabase.html#lastError</a></p>
</blockquote>
<p dir="auto">it returns TRUE</p>
]]></description><link>https://forum.qt.io/post/704149</link><guid isPermaLink="true">https://forum.qt.io/post/704149</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Thu, 24 Feb 2022 15:21:09 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Thu, 24 Feb 2022 10:45:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/flocgn">@<bdi>FloCGN</bdi></a> said in <a href="/post/704037">no connection with qsqlite</a>:</p>
<blockquote>
<p dir="auto">I think its right</p>
</blockquote>
<p dir="auto">You think or you know?</p>
<p dir="auto">"error checks are debugging functions ?" - no.<br />
What does db.open() return?  And please do not post some screen-shot, print it out!</p>
<pre><code>print(db.open())
</code></pre>
<p dir="auto">If it returns false then check <a href="https://doc.qt.io/qt-5/qsqldatabase.html#lastError" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qsqldatabase.html#lastError</a></p>
]]></description><link>https://forum.qt.io/post/704112</link><guid isPermaLink="true">https://forum.qt.io/post/704112</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 24 Feb 2022 10:45:01 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Wed, 23 Feb 2022 22:14:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> the content of the database file ? I think its right</p>
<p dir="auto">error checks are debugging functions ?  I debugged it, but there were no error messages. I don't know if I did it right either. Like I said, I'm a total beginner</p>
]]></description><link>https://forum.qt.io/post/704037</link><guid isPermaLink="true">https://forum.qt.io/post/704037</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Wed, 23 Feb 2022 22:14:02 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Wed, 23 Feb 2022 20:28:52 GMT]]></title><description><![CDATA[<p dir="auto">Then did you check the content of the file ?<br />
What about adding error checks to your code ?</p>
]]></description><link>https://forum.qt.io/post/704021</link><guid isPermaLink="true">https://forum.qt.io/post/704021</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 23 Feb 2022 20:28:52 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Wed, 23 Feb 2022 20:19:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> The file is in the same folder as the .py file</p>
]]></description><link>https://forum.qt.io/post/704018</link><guid isPermaLink="true">https://forum.qt.io/post/704018</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Wed, 23 Feb 2022 20:19:15 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Wed, 23 Feb 2022 19:52:24 GMT]]></title><description><![CDATA[<p dir="auto">Where is that file located on your system ?<br />
SQLite will create the file if it does not exists hence if your path is wrong you will have an empty database.</p>
]]></description><link>https://forum.qt.io/post/704017</link><guid isPermaLink="true">https://forum.qt.io/post/704017</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 23 Feb 2022 19:52:24 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Wed, 23 Feb 2022 17:25:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a></p>
<p dir="auto">I want to display the "Leistungen" table in the "offene Leistungen" field. But nothing happens</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/737bfbe8-aba3-4104-b173-b12eafe976e6.png" alt="Bildschirmfoto 2022-02-23 um 18.12.59.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">when I write in the terminal db.open(), then this happens:</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/db74dc7e-8c9e-49f3-a237-db3f0900ba20.png" alt="Bildschirmfoto 2022-02-23 um 18.20.07.png" class=" img-fluid img-markdown" /></p>
<pre><code>from PySide6.QtWidgets import QApplication,QMainWindow
from PySide6 import QtSql
from QT.frm_main import Ui_frm_main


class Frm_main(QMainWindow, Ui_frm_main):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        mod_offene_Leistungen = QtSql.QSqlRelationalTableModel()
        mod_offene_Leistungen.setTable("Leistungen")
        mod_offene_Leistungen.select()
        self.tbl_offene_Leistungen.setModel(mod_offene_Leistungen)
        
        


db=QtSql.QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName("Rechnungen.sqlite")
db.open()



app=QApplication()
frm_main=Frm_main()
frm_main.show()
app.exec()
</code></pre>
]]></description><link>https://forum.qt.io/post/703987</link><guid isPermaLink="true">https://forum.qt.io/post/703987</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Wed, 23 Feb 2022 17:25:57 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Wed, 23 Feb 2022 05:20:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/flocgn">@<bdi>FloCGN</bdi></a> said in <a href="/post/703819">no connection with qsqlite</a>:</p>
<blockquote>
<p dir="auto">It doesn’t work</p>
</blockquote>
<p dir="auto">What exactly does not work now?<br />
What does db.open() return?</p>
]]></description><link>https://forum.qt.io/post/703838</link><guid isPermaLink="true">https://forum.qt.io/post/703838</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 23 Feb 2022 05:20:44 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Tue, 22 Feb 2022 23:49:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> the code should then look like this ??</p>
<pre><code>db=QtSql.QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName("Rechnungen.db")
db.open()
</code></pre>
<p dir="auto">It doesn’t work..</p>
<p dir="auto">sry for the stupid questions</p>
]]></description><link>https://forum.qt.io/post/703819</link><guid isPermaLink="true">https://forum.qt.io/post/703819</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Tue, 22 Feb 2022 23:49:53 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Tue, 22 Feb 2022 21:33:15 GMT]]></title><description><![CDATA[<p dir="auto">As already suggested by <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a>, you are missing a call to the open method of your db object.</p>
]]></description><link>https://forum.qt.io/post/703816</link><guid isPermaLink="true">https://forum.qt.io/post/703816</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 22 Feb 2022 21:33:15 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Tue, 22 Feb 2022 21:21:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> I just want to include the "Rechnungen.db" database. For this I want to display the "Leistungen" table in "tbl_offene_leistungen" in my gui. It's my first code, it would be great if someone could show me a sample here.</p>
]]></description><link>https://forum.qt.io/post/703815</link><guid isPermaLink="true">https://forum.qt.io/post/703815</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Tue, 22 Feb 2022 21:21:17 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Tue, 22 Feb 2022 20:00:10 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">Do you mean the code from the <a href="https://doc.qt.io/qtforpython/PySide6/QtSql/QSqlDatabase.html" target="_blank" rel="noopener noreferrer nofollow ugc">Python documentation</a> of the class ?</p>
]]></description><link>https://forum.qt.io/post/703804</link><guid isPermaLink="true">https://forum.qt.io/post/703804</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 22 Feb 2022 20:00:10 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Tue, 22 Feb 2022 19:57:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> can you send me the code according to the documentation above ?</p>
]]></description><link>https://forum.qt.io/post/703801</link><guid isPermaLink="true">https://forum.qt.io/post/703801</guid><dc:creator><![CDATA[FloCGN]]></dc:creator><pubDate>Tue, 22 Feb 2022 19:57:15 GMT</pubDate></item><item><title><![CDATA[Reply to no connection with qsqlite on Tue, 22 Feb 2022 17:36:50 GMT]]></title><description><![CDATA[<p dir="auto">Maybe you should open the database as described in the <a href="https://doc.qt.io/qt-6/qsqldatabase.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">documentation</a>?</p>
]]></description><link>https://forum.qt.io/post/703767</link><guid isPermaLink="true">https://forum.qt.io/post/703767</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 22 Feb 2022 17:36:50 GMT</pubDate></item></channel></rss>