<div>hi,</div>
<div> </div>
<div>try this for connection</div>
<div> </div>
<div>db= QSqlDatabase.addDatabase("QODBC")<br>connectionString = "DRIVER={SQL Server};SERVER=<font face="Courier New">localhost</font>;UID=<font face="Courier New">myuser</font>;PWD=<font face="Courier New">mypassw</font>;DATABASE=<font face="Courier New">dnsMySQL</font>;"<br>
db.setDatabaseName(connectionString)</div>
<div>if not db.open():<br> print db.lastError().text()<br> sys.exit(1)<br> <br>Kermit<br> </div>
<div><span class="gmail_quote">2008/3/6, Mario Daniel Carugno <<a href="mailto:carugnom@gmail.com">carugnom@gmail.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi, i've installed pyqt4 + python2.5 in windows, and wrote a small script to test ODBC access to <br>a MySQL table. The script is:<br>
<br><span style="FONT-FAMILY: courier new,monospace">from PyQt4 import QtSql<br>import sys<br><br>db = QtSql.QSqlDatabase.addDatabase("QODBC")<br>db.setDatabaseName("dnsMySQL")<br>db.setHostName("localhost")<br>
db.setUserName("myuser")<br>db.setPassword("mypassw")<br><br>if not db.open():<br> txt = db.lastError().text()<br> print unicode(txt)<br> sys.exit()<br><br>qry = QtSql.QSqlQuery()<br>qry.exec_( "select id from mytable where id = 20" )<br>
<br>if qry.next():<br> a = qry.value(0).toInt()<br> print a<br><br></span>I run it and executes (it prints the value of a) but then the following error appears:<br><br><span style="FONT-FAMILY: courier new,monospace">the instruction at "0x00ea2acf" referenced memory at "0x01013f20". The memory could not be "read".<br>
</span><br>What's the problem ? Any idea ?<br><br>Thanks<br><br><br><br>_______________________________________________<br>PyQt mailing list <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br>