QtÊý¾Ý¿â£¨Èý£©ÀûÓÃQSqlQueryÀàÖ´ÐÐSQLÓï¾ä£¨Ò»£©
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com ×ªÔØÇë×¢Ã÷³ö´¦¡£
SQL¼´½á¹¹»¯²éѯÓïÑÔ£¬ÊǹØÏµÊý¾Ý¿âµÄ±ê×¼ÓïÑÔ¡£Ç°ÃæÒѾÌáµ½£¬ÔÚQtÖÐÀûÓÃQSqlQueryÀàʵÏÖÁËÖ´ÐÐSQLÓï¾ä¡£ÐèҪ˵Ã÷£¬ÎÒÃÇÕâÀïÖ»ÊÇQt½Ì³Ì£¬¶ø·ÇרҵµÄÊý¾Ý¿â½Ì³Ì£¬ËùÒÔÎÒÃDz»»á¶ÔÊý¾Ý¿âÖеÄһЩ֪ʶ½øÐÐÉîÈë½²½â£¬ÏÂÃæÖ»ÊǶÔ×î³£Óõö֪ʶµã½øÐн²½â¡£
ÎÒÃÇÏÂÃæÏȽ¨Á¢Ò»¸ö¹¤³Ì£¬È»ºó½²½âËĸö֪ʶµã£¬·Ö±ðÊÇ£º
Ò»£¬²Ù×÷SQLÓï¾ä·µ»ØµÄ½á¹û¼¯¡£
¶þ£¬ÔÚSQLÓï¾äÖÐʹÓñäÁ¿¡£
Èý£¬Åú´¦Àí²Ù×÷¡£
ËÄ£¬ÊÂÎñ²Ù×÷¡£
ÎÒÃÇн¨Qt4 Gui Application¹¤³Ì£¬ÎÒÕâÀ﹤³ÌÃûΪquery £¬È»ºóÑ¡ÖÐQtSqlÄ£¿é£¬Base classÑ¡QWidget¡£¹¤³Ì½¨ºÃºó£¬Ìí¼ÓC++ Header File £¬ÃüÃûΪconnection.h £¬¸ü¸ÄÆäÄÚÈÝÈçÏ£º
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QMessageBox>
#include <QSqlDatabase>
#include <QSqlQuery>
static bool createConnection()
{
QSqlDatabase db = QSqlDatabase::addDatabase(“QSQLITE”);
db.setDatabaseName(“:memory:”);
if (!db.open()) {
QMessageBox::critical(0, qApp->tr(“Cannot open database”),
qApp->tr(“Unable to establish a database connection.”
), QMessageBox::Cancel);
return false;
}
QSqlQuery query;
query.exec(“create table student (id int primary key, ”
“name varchar(20))”);
query.exec(“insert into student values(0, ‘first’)”);
query.exec(“insert into student values(1, ’second’)”);
query.exec(“insert into student values(2, ‘third’)”);
&
Ïà¹ØÎĵµ£º
/*****************************
³£ÓÃÈÕÆÚº¯Êý
*****************************/
use studentInfo
--ÏòÊý¾Ý¿âÖвåÈëÈÕÆÚµÄ³£¼û¸ñʽ£ºÈç²åÈë2010Äê10ÔÂ3ÈÕÕâ¸öÈÕÆÚ
--ÆäÖÐtb_dateΪһ¸ö²âÊÔÓÃµÄ±í£¬ÀïÃæ¾ÍÒ»¸ö×Ö¶Îtime£¬ÎªdatetimeÀàÐÍ
insert tb_date values('2010.10.3')
insert tb_date values('2010-10-3 12:14:35 ......
1,ÏÔʾÓαêµÄ²Ù×÷
(1) ¶¨ÒåÓαê
¸ù¾Ý²éѯµÄÊý¾ÝÇé¿ö£¬ÔÚPL/SQL¿éµÄÉùÃ÷²¿·Ö¶¨ÒåÓα꣬Ó﷨Ϊ£º
cursor cursor_name is select_statement;
×¢Ò⣺
ÓÎ±ê±ØÐëÔÚPL/SQL¿éµÄÉùÃ÷²¿·Ö½øÐж¨Ò壻
......
SQL Server µÄÄ£Äâ
רÀ¸×÷¼Ò£ºDeanna Dicken 2010Äê2ÔÂ12ÈÕ
·Ò룺 UltraDBA 2010Äê5ÔÂ25ÈÕ
ÔÌûµØÖ·£ºhttp://www.databasejournal.com/features/mssql/article.php/3863516/SQL-Server-Impersonation.htm
½éÉÜ
SQL Server µÄÄ£Ä⣬»òÉÏÏÂÎÄÇл»£¬ÊÇÒ»ÖÖ·½Ê½£¬ÔÊÐíµ± ......
´´½¨Ò»ÕÅ±í£¬Ö±½ÓÔÚ±íÁÐÉϰó¶¨Ä¬ÈÏÖµ
CREATE TABLE hello
(
Id_P int PRIMARY KEY,
Firstname varchar(50) DEFAULT 'Bush',
Lastname varchar(50) DEFAULT 'Green',
Address varchar(50) DEFAULT 'China',
City varchar(50) DEFAULT 'beijing'
)
²åÈëÒ»ÌõÐÅÏ¢
INSERT INTO hello(Id_P) values(01)
½á¹ûÊÇ
×ܽ ......
/*
SQL SERVER 2008 ѹËõ±¸·Ý
SQL SERVER 2008 ÔÚÆóÒµ°æºÍ¿ª·¢°æÖÐÒýÈëÁ˱¸·ÝѹËõ.ʹÓÃÕ߸ö¹¦ÄÜ¿ÉÒÔ¸ü¿ìËٵı¸·ÝÊý¾Ý¿â²¢ÇÒ
ÏûºÄ¸üÉٵĴÅÅ̿ռä.ѹËõÁ¿ÒÀÀµÓÚÊý¾Ý¿âÖд洢µÄÊý¾Ý.ÀýÈç,º¬ÓÐÖØ¸´Öµ×Ö·ûÊý¾ÝµÄÊý¾Ý¿â¿ÉÒÔÓÐ
  ......