hibernateɾ³ý²Ù×÷µÄsqlÓï¾äд·¨
µÚÒ»ÖÖ£º
public void deleteUser(String byemail) {
Session session = getSession();
Transaction transaction = null;
String hql = "delete from Register where email=?
";
try {
transaction = session.beginTransaction();
System.out.println(hql);
Query q = session.createQuery(hql);
System.out.println(q);
q.setParameter(0,byemail);//ÕâÀïÓÃsetParameter
(int position, Object val)
System.out.println("q+++++++");
q.executeUpdate();
System.out.println("update");
transaction.commit();
System.out.println("commit");
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
if (transaction != null) {
// µ±·¢ÉúÒ쳣ʱ»Ø¹öÊÂÎñ£¬È¡ÏûÊý¾Ý¿â²Ù×÷
transaction.rollback();
System.out.println("#######ɾ³ý·¢ÉúÒì³££¬ÊÂÎñ»Ø¹ö#########");
}
} finally {
session.close();
}
µÚ¶þÖÖ£º
public void deleteUser(String byemail
) {
Session session = getSession();
Transaction transaction = null;
String hql = "delete from Register where email=:byemail
";
try {
transaction = session.beginTransaction();
System.out.println(hql);
Query q = session.createQuery(hql);
System.out.println(q);
q.setParameter("byemail
",byemai
l);
System.out.println("q+++++++");
q.executeUpdate();
System.out.println("update");
transaction.commi
Ïà¹ØÎĵµ£º
1.½¨±í
create table temp(rq varchar(10),shengfu nchar(1))
2.²åÈëÊý¾Ý
insert into temp values('2005-05-09','ʤ')
insert into temp values('2005-05-09','ʤ')
insert into temp values('2005-05-09','¸º')
insert into temp values('2005-05-09','¸º')
insert into temp values('2005-05-10','ʤ')
insert i ......
SQL×¢Èë¹¥»÷·À·¶¼¼ÇÉ
Ò»°ãµÄSQL×¢Èë¹¥»÷¶¼ÊÇͨ¹ý¹¹½¨Ò»Ìõ¸´ÔÓµÄsqlÓï¾ä£¬
ͨ¹ýÍøҳ©¶´À´Ö´ÐÐsqlÓï¾ä£¬´ïµ½¹¥»÷Êý¾Ý¿âµÄÄ¿µÄ¡£
Èçͨ¹ýÎÄÕÂIDÀ´²éѯijһƪÎÄÕµÄÍøÒ³£¬
ͨ³£²ÉÓõÄsqlÓï¾äΪ£º
sql="select top 1 * from articles where articId="&request("id")
ÄÇô¿ÉÒÔ¼òµ ......
SQLº¯ÊýÖ®ËÄÉáÎåÈ루ת×Ôhttp://ln1058.javaeye.com/blog/191502£©
ÎÊÌâ1£º
SELECT CAST('123.456' as decimal) ½«»áµÃµ½ 123£¨Ð¡ÊýµãºóÃæµÄ½«»á±»Ê¡ÂÔµô£©¡£
Èç¹ûÏ£ÍûµÃµ½Ð¡ÊýµãºóÃæµÄÁ½Î»¡£
ÔòÐèÒª°ÑÉÏÃæµÄ¸ÄΪ
SELECT CAST('123.456' as decimal(38, 2)) ===>123.46
×Ô¶¯ËÄÉáÎåÈëÁË£ ......
ORACLEÊý¾Ý¿âÀï±íµ¼ÈëSQL ServerÊý¾Ý¿â
1¡¢ÔÚÄ¿µÄSQL ServerÊý¾Ý¿â·þÎñÆ÷ÉÏ°²×°ORACLE ClientÈí¼þ»òÕßORACLE ODBC Driver.
ÔÚ$ORACLE_HOME\network\admin\tnsnames.oraÀïÅäÖÃORACLEÊý¾Ý¿âµÄ±ðÃû(service name)¡£
2¡¢ÔÚWIN2000»òÕßwin200 ......