#2
xiao_99042012-06-05 08:20
|
程序代码:
QSqlDatabase mysqldb=QSqlDatabase::addDatabase("QMYSQL");
mysqldb.setHostName(QObject::tr("10.0.1.209"));
mysqldb.setDatabaseName(QObject::tr("skystore"));
mysqldb.setUserName(QObject::tr("skystore"));
mysqldb.setPassword(QObject::tr("8888"));
if(!mysqldb.open())
{
QMessageBox::critical(0,QObject::tr("DataBase Error!"),mysqldb.lastError().text());
}else{
QMessageBox::critical(0,QObject::tr("DataBase OK!"),QObject::tr("DataBase OK!"));
}
难道写个连接远程数据库的软件电脑上还要装个MySQL吗