2008年3月11日 星期二

Code Snippet titled [Method Stub - Body] failed to load

VS2005:
如果进行override操作时,提示: Code Snippet titled [Method Stub - Body] failed to load. Verify that refactoring snippets are recognized in the Code Snippet Manager and that the snippet files are valid on disk. 那说明指 定的Code Snippet块无法找到,解决办法很简单,只要重新导入Code Snippet块就行了。找到并打开Code Snippet Manager(Ctrl + K,Ctrl + B),然后选择要操作的语言(C#),用Add按钮导入两个默认的文件夹:Refactoring和Visual C#,这两个文件夹一般会在VS2005安装目录下的,如:C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033 ,如果有这两个文件夹,则先删除然后再导入。

轉載自:
http://www.cnblogs.com/ttinfo/archive/2007/04/26/727784.html

2008年3月7日 星期五

文件已儲存,但因儲存空間不足

WORD 存檔出現的錯誤

"文件已儲存,但因儲存空間不足,導致語音辨識資料遺失,不錄音時請務必關閉麥克風,並檢查磁碟可用空間"

解法:
開WORD--工具--選項--儲存--內嵌語言資料,不勾選,按確定重新存一次

2008年3月5日 星期三

SQL將字串欄位轉為Table的方法

SQL裡,將字串欄位轉為Table的方法:


/* -- 傳入參數 -- */

declare @list nvarchar(4000)
declare @delimiter nchar(1)

set @list=@companyAll    -- 將@companyAll 改為待處理字串
set @delimiter='
㊣'   -- 將 @delimiter 改為分隔符號

/* -- END -- */

create table #tmp ( listpos int IDENTITY(1, 1) NOT NULL,str varchar(4000),nstr nvarchar(2000))
DECLARE @pos int,
@textpos int,
@chunklen smallint,
@tmpstr nvarchar(4000),
@leftover nvarchar(4000),
@tmpval nvarchar(4000)

SET @textpos = 1
SET @leftover = ''

WHILE @textpos <= datalength(@list) / 2 BEGIN

SET @chunklen = 4000 - datalength(@leftover) / 2
SET @tmpstr = @leftover + substring(@list, @textpos, @chunklen)
SET @textpos = @textpos + @chunklen
SET @pos = charindex(@delimiter, @tmpstr)

WHILE @pos > 0
BEGIN
SET @tmpval = ltrim(rtrim(left(@tmpstr, @pos - 1)))
INSERT #tmp (str, nstr) VALUES(@tmpval, @tmpval)
SET @tmpstr = substring(@tmpstr, @pos + 1, len(@tmpstr))
SET @pos = charindex(@delimiter, @tmpstr)

END

SET @leftover = @tmpstr

END

INSERT #tmp(str, nstr)
VALUES (ltrim(rtrim(@leftover)), ltrim(rtrim(@leftover)))


/* 刪除空白資料筆數 */
delete #tmp where len([str])=0
select * from #tmp
/* 清除暫存 table */
drop table #tmp

PS:為何要用㊣來當作區隔,因為在我的現實案例中,逗號已經無法當作唯一辨識了,所以才會選擇㊣。當然,可以根據實際情況來選擇所要區隔的符號。

2008年2月20日 星期三

透過javascript去抓網頁URL傳進來的參數

//透過javascript去抓網頁URL傳進來的參數:


//宣告

var LocString=String(window.document.location.href);

function GetQueryString(str)
{

var rs=new RegExp("(^|)"+str+"=([^\&]*)(\&|$)","gi").exec(LocString),tmp;

if(tmp=rs)
return tmp[2]; return "
沒有這個參數";

}

//使用

var v=GetQueryString('tmp_new_version');
alert(v);

2007年11月27日 星期二

SQL的 ASCII

在SQL語法,如果想要根據已知英文字母決定下一個字母時,
可以透過 ASCII( ) 函式來完成。ASCII( ) 會回傳字元的ASCII數字,
然後把這數字+1之後,就會是下一個字母。最後利用 CHAR( )函式
把 ASCII 值轉換回字母。

2007年11月9日 星期五

Reporting Service 專案複製時注意事項

當你複製報表專案給其他人時,記得要在資料來源的地方,選擇編輯,重新指定連接資料庫的密碼。因為當你複製專案給其他人之後,資料連結的密碼會被清掉。

Error Msg:
無法完成目前的動作,因為報表伺服器資料庫中,並未儲存執行此報表所需的使用者資料來源認證。 (rsInvalidDataSourceCredentialSetting)

2007年11月8日 星期四

分類區塊隱藏與顯示的控制

需求:每個區塊都有一個CheckBox,當CheckBox被勾選,才顯示該區塊


<input type="checkbox" onclick="cbFunction(this);" id="cb1" name="cb1" runat="server">
T1

<br>

<div id="v1" style="DISPLAY:none">

<table>

<tr>

<td>This is table 1</td>

</tr>

<tr>

<td>

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>

<asp:Button id="Button1" runat="server" Text="隱藏Table1"></asp:Button></td>

</tr>

</table>

</div>

<br>

<input type="checkbox" onclick="cbFunction(this);" id="cb2" name="cb2" runat="server">
T2

<br>

<div id="v2" style="DISPLAY:none">

<table>

<tr>

<td>This is table 2</td>

</tr>

<tr>

<td>

<asp:TextBox id="TextBox2" runat="server"></asp:TextBox>

<asp:Button id="Button2" runat="server" Text="隱藏Table2"></asp:Button></td>

</tr>

</table>

</div>

</form>

<script>

function cbFunction(object)

{



if(object.id=='cb1')

{

if(object.checked)

{



document.all.v1.style.display='';

}

else

{



document.all.v1.style.display='none';

}

}

if(object.id=='cb2')

{

if(object.checked)

{



document.all.v2.style.display='';

}

else

{



document.all.v2.style.display='none';

}

}

}



cbFunction(document.all.cb1);

cbFunction(document.all.cb2);

</script>