PDA

View Full Version : mysql connection sample



mohanakrishnan
12th November 2009, 07:05
hi
can any one give proper way or sample codes to connect mysql from qt.
because my qt application will insert data frequently ,so whether for each time
i need to open the database and insert then close the connection ???
can i use same connection many times?? so pls i need an explanation if possible
send samples!!
thanks...:confused::confused::confused:

spirit
12th November 2009, 07:25
take a look sqlbrowser demo which is located in QTDRI/demos/sqlbrowser.

mohanakrishnan
12th November 2009, 07:37
hi spirit
thanks i ll look at it...
:D

JohannesMunk
12th November 2009, 17:23
A while back we had a discussion about that.

http://www.qtcentre.org/forum/f-qt-programming-2/t-qsqldatabase-and-create-database--20037.html

You may have to scroll down a bit.. I provided some code using a pointer to the db. That's still the way I'm doing it, even so the recommended way would be to use Qt's default connection stuff..

HIH

Joh