Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

QtÊý¾Ý¿â£¨ËÄ£©ÀûÓÃQSqlQueryÀàÖ´ÐÐSQLÓï¾ä£¨¶þ£©


±¾ÎÄÕÂÔ­´´ÓÚwww.yafeilinux.com ×ªÔØÇë×¢Ã÷³ö´¦¡£
½Ó×ÅÉÏһƪ½Ì³Ì¡£
¶þ£¬ÔÚSQLÓï¾äÖÐʹÓñäÁ¿¡£
ÎÒÃÇÏÈ¿´ÏÂÃæµÄÒ»¸öÀý×Ó£¬½«“²éѯ”°´Å¥µÄ²Ûº¯Êý¸ü¸ÄÈçÏ£º
void Widget::on_pushButton_clicked()
{
    QSqlQuery query;
    query.prepare(“insert into student (id, name) ”
                  “values (:id, :name)”);
    query.bindValue(0, 5);
    query.bindValue(1, “sixth”);
    query.exec();
    //ÏÂÃæÊä³ö×îºóÒ»Ìõ¼Ç¼
    query.exec(“select * from student”);
    query.last();
    int id = query.value(0).toInt();
    QString name = query.value(1).toString();
    qDebug() << id << name;
}
ÔËÐÐЧ¹ûÈçÏ£º
¿ÉÒÔ¿´µ½£¬ÔÚstudent±íµÄ×îºóÓÖÌí¼ÓÁËÒ»Ìõ¼Ç¼¡£ÔÚÉÏÃæµÄ³ÌÐòÖУ¬ÎÒÃÇÏÈʹÓÃÁËprepare()º¯Êý£¬ÔÚÆäÖÐÀûÓÃÁË“:id”ºÍ“:name”À´´úÌæ¾ßÌåµÄÊý¾Ý£¬¶øºóÓÖÀûÓÃbindValue()º¯Êý¸øidºÍnameÁ½¸öÊôÐÔ¸³Öµ£¬Õâ³ÆΪ°ó¶¨²Ù×÷¡£ÆäÖбàºÅ0ºÍ1·Ö±ð´ú±í“:id”ºÍ“:name”£¬¾ÍÊÇ˵°´ÕÕprepare()º¯ÊýÖгöÏÖµÄÊôÐÔ´Ó×óµ½ÓÒ±àºÅ£¬×î×ó±ßÊÇ0 ¡£ÕâÀïµÄ“:id”ºÍ“:name”£¬½Ð×öռλ·û£¬ÕâÊÇODBCÊý¾Ý¿âµÄ±íʾ·½·¨£¬»¹ÓÐÒ»ÖÖOracleµÄ±íʾ·½·¨¾ÍÊÇÈ«²¿ÓÓ£¿”ºÅ¡£ÈçÏ£º
query.prepare(“insert into student (id, name) ”
                  “values (?, ?)”);
query.bindValue(0, 5);
query.bindValue(1, “sixth”);
query.exec();
ÎÒÃÇÒ²¿ÉÒÔÀûÓÃaddBindValue()º¯Êý£¬ÕâÑù¾Í¿ÉÒÔÊ¡È¥±àºÅ£¬ËüÊÇ°´Ë³Ðò¸øÊôÐÔ¸³ÖµµÄ£¬ÈçÏ£º
query.prepare(“insert into student (id, name) ”
                  “values (?, ?)”);
quer


Ïà¹ØÎĵµ£º

SQLÖÐNµÄ×÷ÓÃ?

SQLÖÐNµÄ×÷ÓÃ?
exec sp_executesql N'SELECT TOP 1 ISNULL(vDefine1,'''') AS vMonth, dtBegin, dtEnd from SM_ActMonth WHERE vActID=@P1 AND bCarryForward=@P2 ORDER BY iListID DESC
', N'@P1 varchar(3),@P2 bit', '001', 1
exec sp_executesql N'SELECT * from KEHU WHERE KHDM>=@P1 AND ZK=@P2',N'@P1 VARCHAR ......

ͨ¹ýÅú´¦Àí£¬ÊµÏÖSQL ServerÊý¾Ý¿â¶¨ÆÚ±¸·Ýµ½ftp

@echo off
rem --------------------- ÅäÖÃ: ftpÉÏ´«²ÎÊý,¼°±¾µØÎļþĿ¼(Êý¾Ý¿â±¸·ÝµÄÁÙʱĿ¼)-----------------
set "PUT_FTP_SERVER=192.168.1.100"
set "PUT_FTP_PORT=21"
set "PUT_FTP_USERNAME=ftpuser"
set "PUT_FTP_PASSWORD=ftppasswd"
set "PUT_DIR=/"
set "LOCAL_DIR=D:\sql_dbbackup\"
rem ---------- ......

ÔõÑù½«excelÖеÄÊý¾Ýͨ¹ýPL/SQLµ¼ÈëORACLEÊý¾Ý¿âÖÐ

ÏêϸµØ²½Öè:


1¡¢´ò¿ªMicroSoft   Excel   2000  


2¡¢Îļþ(F)→н¨(N)→¹¤×÷²¾→  


3¡¢ÊäÈëÊý¾Ýºó£¬´æÅÌΪtest.xls£¬  


4¡¢Îļþ(F)→Áí´æΪ(A)→  


±£´æÀàÐÍΪ£ºÖƱí·û·Ö¸ô£¬ÆðÃûΪtext.txt£¬±£´æµ½C:\ &nb ......

Ò»¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSqlÓï¾ä(ÕûÀí°æ)

/*
±êÌ⣺һ¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSqlÓï¾ä(ÕûÀí°æ)
×÷Õߣº°®Ð¾õÂÞ.ع»ª(Ê®°ËÄê·çÓ꣬ÊصñùɽѩÁ«»¨¿ª)
ʱ¼ä£º2010-05-10
µØµã£ºÖØÇ캽ÌìְҵѧԺ
˵Ã÷£ºÒÔÏÂÎåÊ®¸öÓï¾ä¶¼°´ÕÕ²âÊÔÊý¾Ý½øÐйý²âÊÔ£¬×îºÃÿ´ÎÖ»µ¥¶ÀÔËÐÐÒ»¸öÓï¾ä¡£
ÎÊÌâ¼°ÃèÊö£º
--1.ѧÉú±í
Student(S#,Sname,Sage,Ssex) --S# ѧÉú±àºÅ,Sname ѧÉúÐÕÃû,S ......

QtÊý¾Ý¿â£¨Èý£©ÀûÓÃQSqlQueryÀàÖ´ÐÐSQLÓï¾ä£¨Ò»£©


±¾ÎÄÕÂÔ­´´ÓÚwww.yafeilinux.com ×ªÔØÇë×¢Ã÷³ö´¦¡£
SQL¼´½á¹¹»¯²éѯÓïÑÔ£¬ÊǹØϵÊý¾Ý¿âµÄ±ê×¼ÓïÑÔ¡£Ç°ÃæÒѾ­Ìáµ½£¬ÔÚQtÖÐÀûÓÃQSqlQueryÀàʵÏÖÁËÖ´ÐÐSQLÓï¾ä¡£ÐèҪ˵Ã÷£¬ÎÒÃÇÕâÀïÖ»ÊÇQt½Ì³Ì£¬¶ø·ÇרҵµÄÊý¾Ý¿â½Ì³Ì£¬ËùÒÔÎÒÃDz»»á¶ÔÊý¾Ý¿âÖеÄһЩ֪ʶ½øÐÐÉîÈë½²½â£¬ÏÂÃæÖ»ÊǶÔ×î³£Óõļ¸¸ö֪ʶµã½øÐн²½â¡£
ÎÒÃÇÏÂÃ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ