SQLÓï¾äÕýÈ·µ«ÊÇRESULTSETÖÐûÓÐÖµ
StringBuffer str = new StringBuffer("select * from menu where parentid=1 and mid <>1 order by parentid");
List list = new ArrayList();
ResultSet rst = null;
DataBaseConnection dbc = null;
PreparedStatement pstm = null;
try {
dbc = new DataBaseConnection();
pstm = dbc.getConnection().prepareStatement(str.toString());
rst = dbc.query(pstm);
while(rst.next()){
System.out.println(rst.getString("name"));
}
RSTÖÐûÓÐÈκÎÖµ
Êý¾Ý¿â ORACLE 10G
²»ÖªµÀÄãµÄÊÇÔõô·â×°µÄ²éѯ£¬ÓÐÎÊÌâÒ»¶¨ÊÇdbc.query(pstm)ûÓеõ½ÕýÈ·µÄ½á¹û¼¯
Ϊʲô²»Ö±½Ó²éÑ¯ÄØ£¿
try {
dbc = new DataBaseConnection();
pstm = dbc.getConnection().prepareStatement(str.toString());
rst = pstm.executeQuery();
while(rst.next()){
System.out.println(rst.getString("name"));
}
public ResultSet query(PreparedStatement pstm) throws SQLException,
Exception {
this.rst = pstm.executeQuery();
return rst;
}
ÕâÊǺǫ́²éѯ
·â×°Õâ¸ö·½·¨ºÃÏñûɶÒâÒå°¡
ÄãµÄsqlÔÚ¹¤¾ßÀïÄܲé³ö¶«Î÷Âð£¿
public ResultSet query(PreparedStatement pstm) throws SQLException,
Exception {
return pstm.executeQuery();
}
PLSQL DEVELOPER Äܲé³öÀ´£¬½á¹ûÕýÈ·
Ö
Ïà¹ØÎÊ´ð£º
½«Ò»¸ö²éѯÓï¾ä¸³¸øÒ»¸ö±äÁ¿£¬ÈçÏ£º
DECLARE @STR NVARCHAR(MAX)
SET @STR='SELECT * from SALE_PROD'
ÔõôÑù²ÅÄÜÖ´ÐÐËüÄØ£¿
Çë¸ßÊÖ£¬ÈÊÐÖ£¬ÏÀ½ã°ï°ïæ°¡
¶àл£¬¿ÉÒÔÀ²£¬¸ßÊÖ°¡
Ö±½ÓÖ´ÐоÍÐÐÁË
exec ......
Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿
ÖÁÉٵø½¼Óµ½sqlserverÉÏ
¾ßÌåÔõôŪ°¡ ÎҵıÏÒµÉè¼ÆµÄÊý¾Ý¿âÊÇ´ÓÍøÉÏdownÏÂÀ´µÄ£¿£¿
Ä㻹²»ÈçÖ±½ÓÓÃsqlserverÄØ
º¯Êý¡¢´æ´¢¹ý³Ì¶¼µÃ¸ÄÁË¡£
sqlserverûÔõôÓùý¡£Ò²Ã»Óа²× ......
SQL code:
rs.open "select * from guide where city_name='±±¾©' order by pai desc",conn,1,1
do while not rs.eof or rs.bof
¡£¡£
¡£¡£
¡£¡£
rs.movenext
loop
Õâ¸ösqlÓï¾äÔÚwapÕ¾Àï ±¾ÉíÓÐ ......
A±í ÓÐÁ½¸ö×Ö¶Î
id ΨһÊý×ÖÓò
InfoTxt text ÀàÐÍ
ÎÒÏÖÔÚÒª°Ñ id ²»ÊÇ14 µÄËùÓÐ InfoTxt×Ö¶Î Îı¾ºóÃæ ¶¼¼ÓÉÏ 'aaa'
°´ÏÂÃæÖ´ÐÐÏÂÀ´ Ö»Óбí×îºóÒ»ÐмÓÉÏÁË 'aaa' ......
ÎÒÓÐÒ»¸ö×Ö¶ÎÊÇ varchar(1) ÀàÐÍ£¬¶þ½øÖƱíʾҲ¾ÍÊÇ8λµÄ ¡®0000 0000¡¯
±ÈÈçÕâ¸öʱºòÎÒÐèҪɸѡ³öÕâ¸ö×Ö¶ÎΪËùÓÐµÄ ¡®0000 0100¡¯µÄÐУ¬ÇëÎÊSQLÄÜʵÏÖÕâÑùµÄ¡°Î»¡±µÄɸѡÂð£¿
лл~~~
ÓÐλ²Ù×ݺ¯ÊýÂ𣿲»ÐоÍ× ......