原來好好的
突然報這樣的錯誤
檢查數據庫驅動的版本是不是跟數據庫一致,升級數據庫驅動,問題沒有再出現
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace psms.util
{
class Log
{
/// <summary>
/// 寫日志文件
/// </summary>
/// <param name="sMsg"></param>
public static void WriteLog(string sMsg)
{
if (sMsg != "")
{
//Random randObj = new Random(DateTime.Now.Millisecond);
//int file = randObj.Next() + 1;
string filename = DateTime.Now.ToString("yyyyMM") + ".log";
try
{
FileInfo fi = new FileInfo(Application.StartupPath + "\\log\\" + filename);
if (!fi.Exists)
{
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(DateTime.Now + "\n" + sMsg + "\n");
sw.Close();
}
}
else
{
using (StreamWriter sw = fi.AppendText())
{
sw.WriteLine(DateTime.Now + "\n" + sMsg + "\n");
sw.Close();
}
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
}
頁面中有幾個數據項用struts的<html:select>標簽展示,今天提出新的需求,要不允許修改這幾個<html:select>,那就禁用咯,這樣問題發現了,這個頁面是來自action,給<html:select>對應actionForm中的屬性付了值,頁面顯示<html:select>自然就選中被賦值的選項,但是提交表單的時候,數據保存的確總是<html:select>列表中的第一個值,如果去掉禁用,就正常了。暈。
試著在onload中用js禁用也不行
在網上搜到一個這樣的寫法,實現readonly了<select onbeforeactivate="return false" onfocus="this.blur()" onmouseover="this.setCapture()" onmouseout="this.releaseCapture()">

</select>
不過要用到<html:select>中要把onbeforeactivate="return false" 去掉,<html:select>不認識這個屬性,不過效果還是實現了。
今天周末,被頭兒過來改bug
其中一個在hql查詢的時候報org.hibernate.hql.ast.QuerySynt
在網上找org.hibernate.hql.ast.QuerySynt
1、持久類寫錯了,要不就是寫成了數據庫表名
2、hibernate3.0不支持select中嵌套查詢,據說from中也不行,只支持where中嵌套查詢,好像3.1支持了select中嵌套
3、sql語句中字段是用了保留關鍵字
然后就是我發現的這個隱蔽錯誤了
發現的from后的空格是一個全角的空格,半角 空格,全角 空格。距離比一樣啊,原來就看出from后面的空格大了,還以為是兩個空格呢。
隱蔽,太隱蔽了。
org.hibernate.hql.ast.QuerySynt
at org.hibernate.hql.ast.ErrorCoun
at org.hibernate.hql.ast.QueryTran
at org.hibernate.hql.ast.QueryTran
at org.hibernate.hql.ast.QueryTran
at org.hibernate.engine.query
at org.hibernate.engine.query
at org.hibernate.engine.query
at org.hibernate.impl.AbstractSess
at org.hibernate.impl.AbstractSess
at org.hibernate.impl.SessionImpl
at com.capinfo.zgbm.print.dao
at com.capinfo.zgbm.print.action
at org.apache.struts.action
at org.apache.struts.action
at org.apache.struts.action
at org.apache.struts.action
at javax.servlet.http.HttpServlet
at javax.servlet.http.HttpServlet
at weblogic.servlet.internal
at weblogic.servlet.internal
at weblogic.servlet.internal
at weblogic.servlet.internal
at weblogic.servlet.internal
at com.capinfo.util.LoginFilter
at weblogic.servlet.internal
at com.capinfo.util.SetCharacterEn
at weblogic.servlet.internal
at weblogic.servlet.internal
at weblogic.security.acl.internal
at weblogic.security.service
at weblogic.servlet.internal
at weblogic.servlet.internal
at weblogic.servlet.internal
at weblogic.work.ExecuteThread
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: line 1:23: unexpected token: ApplyInfo
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.antlr
at org.hibernate.hql.ast.QueryTran
... 33 more
想到屏蔽頁面所有功能,思路是用戶點擊按鈕,調用一個javascript方法,顯示預先在頁面中定義好的隱藏div,返回結果后再隱藏div,允許用戶繼續操作。
==========================================================
<html>
<head>
<title>半透明div</title>
<style>
.#mask {
visibility: hidden;
background-color: #cccccc;
left: 0px;
position: absolute;
top: 0px;
background-image: none;
filter: alpha(opacity : 50);
}
.#dialog {
visibility: hidden;
background-color: #f7fcfe;
z-index: 100;
width: 300px;
height: 50px;
position: absolute;
text-align: center;
font-size: 30px;
color: #FF0000;
font-weight: bold;
vertical-align: middle;
}
</style>
<script language="javaScript">
function show()
{
var d_mask=document.getElementById('mask');
var d_dialog = document.getElementById('dialog');
d_mask.style.width = document.body.clientWidth ;
d_mask.style.height=document.body.clientHeight;
//網頁正文全文
//d_mask.style.width = document.body.scrollWidth ;
//d_mask.style.height=document.body.scrollHeight;
d_dialog.style.top = document.body.clientHeight / 2 - 60;
d_dialog.style.left =document.body.clientWidth / 2 -100;
d_mask.style.visibility='visible';
d_dialog.style.visibility='visible';
}
function divBlock_event_mousedown()
{
var e, obj, temp;
obj=document.getElementById('dialog');
e=window.event?window.event:e;
obj.startX=e.clientX-obj.offsetLeft;
obj.startY=e.clientY-obj.offsetTop;
document.onmousemove=document_event_mousemove;
temp=document.attachEvent?document.attachEvent('onmouseup',document_event_mouseup):document.addEventListener('mouseup',document_event_mouseup,'');
}
function document_event_mousemove(e)
{
var e, obj;
obj=document.getElementById('dialog');
e=window.event?window.event:e;
with(obj.style){
position='absolute';
left=e.clientX-obj.startX+'px';
top=e.clientY-obj.startY+'px';
}
}
function document_event_mouseup(e)
{
var temp;
document.onmousemove='';
temp=document.detachEvent?document.detachEvent('onmouseup',document_event_mouseup):document.removeEventListener('mouseup',document_event_mouseup,'');
}
window.onresize = function()
{
var d_mask=document.getElementById('mask');
var d_dialog = document.getElementById('dialog');
d_mask.style.width = document.body.clientWidth ;
d_mask.style.height=document.body.clientHeight;
}
</script>
</head>
<div id ="mask"></div>
<div id ="dialog" onmousedown="divBlock_event_mousedown()">處理中,請等待……</div>
<body>
<table border='0' width="100%" height="100%">
<tr>
<td>
測試
</td>
</tr>
<tr>
<td>
<input type="button" value="顯示div" onclick="show()" />
</td>
</tr>
</table>
</body>
</html>
秋 23:58:43
哥也許我把你氣壞了, 我從來都是這樣的,媽也說過我那么多回讓我改,我敢說我來北京以后脾氣根在家我改了很多,每次回家我是多多少少干了一點,也有沒有干的時候,我也不想說什么我干了什么和沒有干什么了,沒有用,我一周就回來了一次,不是天天在家閑著,要是那樣我沒有做也行,在家的時候我要是不想做飯了根媽說讓媽做媽沒有說你怎么不做飯等著吃呢,她也知道我想玩會, 我就是有點不服氣,也就這么點事,本來明天回家了高興得很, 今天我把米飯做好了, 說讓你回來買點菜回來就行了,從你把面包丟給我我也看出來了,我也生氣你要不就別給我,你讓我拿電腦回去,我不愿意拿一是我不想拿,而是我還怕丟了,爸爸那人你又不是不知道說話就那樣,你呢還非得跟他較勁,你拿回去爸爸能怎么想,他能高興,他主要是不懂得電腦就以為壞了,其實他說的也沒有錯,本來你買的就沒有他這個好,要是買一樣的你也不能和他換,所以他也就是發泄2下,找明白人給他弄好了也就沒有事了,不知道你還老抓住這個不放什么,非給他拿回去,說到我過年回來我不回來了,老師說過你不能每周都回去,也得要鍛煉著自己獨立,周日多出去轉轉,我也想了不回來也行,也省得你說我禮貌不到,因為是在家里我跟本就沒有注意到也沒有上心里去,說到爸把我交給你是個極大的錯誤, 我也說了讓你不用管了,我比誰都后悔來到著,我當初也說過我寧愿在家受累也不想來這,我知道上好的話能改變自己的一生,我知道媽他們掙錢是多么的不容易,我也不能讓這2萬塊錢白交,不管學多少我學了,我盡力了, 這點我很清楚,我在著呢也讓你跟著操心,我知道,因為你是我哥,我有什么不對的地方咱都是家里人沒有什么,回家的時候我看你和嫂子在廚房也不說話,我以為你們生氣了,平常看你們鬧那肯定什么事也沒有,從周六我回來到今天我看你也不怎么高興,今天回來也沒有說話,我沒有進廚房,你們倆在廚房了誰也不吱聲,我也就沒有進去,說了這么多也沒有說到什么重點,我呢脾氣就是這樣僵,生氣的時候什么話都能夠說出來,清醒了知道自己錯了,不管怎么樣你是我哥,我也拿你當哥,我也會慢慢改脾氣的,一下子是不能改過來的,這一快過年了我們也都希望全家都高高興興的過年,都是一家人,沒有什么大不了的,都是親的沒有什么深仇大恨,我希望今天這頁就掀過去了,惹你生氣了,我也知道自己錯了,明天我就回家了希望讓媽他們看到我高興的回去再來,和你們處得也融洽,不讓媽擔心,希望你回去以后也能夠跟爸和和睦睦的,我們全家都過了好年,今年家里多了嫂子也是喜事,我呢也不說了,希望你能把今天的事忘了吧,要是能原諒妹子這次呢,就發個信息給我吧。不原諒就當我什么也沒有說好吧。
當幸福來敲門 威爾-斯密斯
晚上沒事,重溫了《當幸福來敲門》的下半部分(上半個不知道怎么沒弄沒了,呵呵)
I like it
也許應該找點東西感動感動,要不然被周圍的冷漠淹沒了
奮斗是根本,想想自己的境況比Chris好一點,還沒有落魄的在衛生間過夜,多虧了父母的肩膀啊,可也有過半夜搬家的日子,我們還沒有Chris努力,所以我們也會沒有Chris成功
但是我們還想成功,還想住大房子,開小車,可那不是大風刮來的
當幸福來敲門 多美的一句話
function useLoadingMessage(message) {
var loadingMessage;
if (message) loadingMessage = message;
else loadingMessage = "Loading";
DWREngine.setPreHook(function() {
var disabledZone = $('disabledZone');
if (!disabledZone) {
disabledZone = document.createElement('div');
disabledZone.setAttribute('id', 'disabledZone');
disabledZone.style.position = "absolute";
disabledZone.style.zIndex = "1000";
disabledZone.style.left = "0px";
disabledZone.style.top = "0px";
disabledZone.style.width = "100%";
disabledZone.style.height = "100%";
document.body.appendChild(disabledZone);
var messageZone = document.createElement('div');
messageZone.setAttribute('id', 'messageZone');
messageZone.style.position = "absolute";
messageZone.style.top = "400px"; //定義顯示加載信息層的位置
messageZone.style.left = "400px"; //定義顯示加載信息層的位置
messageZone.style.width = "150"; //定義顯示加載信息層的寬度
messageZone.style.height = "30"; //定義顯示加載信息層的高度
messageZone.style.background = "red";//定義顯示加載信息層的顏色
messageZone.style.color = "white";
messageZone.style.fontFamily = "Arial,Helvetica,sans-serif";
messageZone.style.padding = "4px";
disabledZone.appendChild(messageZone);
var text = document.createTextNode(loadingMessage);
messageZone.appendChild(text);
}
else {
$('messageZone').innerHTML = loadingMessage;
disabledZone.style.visibility = 'visible';
}
});
DWREngine.setPostHook(function() {
$('disabledZone').style.visibility = 'hidden';
});
}
sql語句編寫能力很差啊,總不用就忘啊,用了聚合函數的查詢,得有group by
第一個行,第二個不行
SELECT
(select rowname from RPT_ROWCODE_SERVCORP rs where rs.rowcode = r.rowcode and tname = 'RPT_AGG_ST_SERV_01_2007') rowname,
r.rowcode,
sum(r.N01),sum(r.N02),sum(r.N03),sum(r.N04),sum(r.N05),sum(r.N06),sum(r.N07),
sum(r.N08),sum(r.N09),sum(r.N10),sum(r.N11),sum(r.N12),sum(r.N13),sum(r.N14),sum(r.N15)
FROM RPT_AGG_ST_SERV_01_2007 r
WHERE r.offino in ('0001') group by r.rowcode
order by r.rowcode
SELECT
rrs.rowcode,rrs.rowname,
sum(r.N01),sum(r.N02),sum(r.N03),sum(r.N04),sum(r.N05),sum(r.N06),sum(r.N07),
sum(r.N08),sum(r.N09),sum(r.N10),sum(r.N11),sum(r.N12),sum(r.N13),sum(r.N14),sum(r.N15)
FROM RPT_AGG_ST_SERV_01_2007 r,RPT_ROWCODE_SERVCORP rrs
WHERE rrs.rowcode = r.rowcode and rrs.tname = 'RPT_AGG_ST_SERV_01_2007' and r.offino in ('0001') group by r.rowcode
order by r.rowcode
//javascript 刪除<select>中選中的選項
function AddClick(field)
{
if(field.selectedIndex != -1)
{
for (var i=0; i < field.options.length; ++i)
{
if (field.options[i].selected)
{
field.options[i] = null;
--i
}
}
}
}