DECLARE @TmpTable1 TABLE(
FC_Title varchar(MAX) ,
FC_Content varchar(MAX),
Brands varchar(MAX),
FC_ID int,
QTY int
);
WITH T AS(
SELECT FC_Title, FC_Content, dbo.GetForumBrands(FC_ID) AS Brands, FC_ID,
(SELECT COUNT(*) FROM Forum F LEFT JOIN UserItem UI ON F.UID=UI.UID WHERE F.FC_ID=FC.FC_ID AND F.FM_IsOpen=1) AS QTY
FROM ForumCatalog FC WHERE FC_IsOpen=1 )
Insert into @TmpTable1(FC_Title, FC_Content, Brands,FC_ID,QTY) select FC_Title, FC_Content, Brands,FC_ID,QTY from T
update @TmpTable1 set QTY = (
select COUNT(*) from
(select k.Id from dbo.KM_Expert k inner join KM_Expert_Estimate e on k.Id = e.ExpertId
group by k.Id) T
) where FC_ID = 10
select * from @TmpTable1 ORDER BY FC_ID
2014年10月16日 星期四
2014年9月16日 星期二
解決 MasterPage Head <% ... %> 錯誤
css:
<link href="~/App_Themes/Theme1/css/grid.css" rel="stylesheet" type="text/css" />
js:
<script type="text/javascript" src='<%#ResolveUrl("~/JavaScript/jquery.cookie.js") %>'></script>
後端:
<link href="~/App_Themes/Theme1/css/grid.css" rel="stylesheet" type="text/css" />
js:
<script type="text/javascript" src='<%#ResolveUrl("~/JavaScript/jquery.cookie.js") %>'></script>
後端:
protected override void OnLoad(EventArgs e)
{
Page.Header.DataBind();
Page.Header.DataBind();
}
2014年7月16日 星期三
SQL 樹 遞迴 查詢所有子節點
WITH T AS
(
SELECT CID,ParentID
, 0 AS Level
FROM SYS_Category
WHERE CID = 8
UNION ALL
SELECT c.CID,c.ParentID, Level +1
FROM SYS_Category c
inner JOIN T t1
ON c.ParentID=t1.CID
)
SELECT * FROM T;
(
SELECT CID,ParentID
, 0 AS Level
FROM SYS_Category
WHERE CID = 8
UNION ALL
SELECT c.CID,c.ParentID, Level +1
FROM SYS_Category c
inner JOIN T t1
ON c.ParentID=t1.CID
)
SELECT * FROM T;
SQL 子查詢 文字累加
select u.*,
(select CONVERT(nvarchar(max),f.RID ) + ','
from UserRoleRelation f
where u.UID = f.UID for xml path('')) role
from SYS_User u
(select CONVERT(nvarchar(max),f.RID ) + ','
from UserRoleRelation f
where u.UID = f.UID for xml path('')) role
from SYS_User u
2014年3月6日 星期四
Scroll Bottom Ajax
//離底部有多少距離
var bottom = parseInt ( $(window).height() / 10 );
//是否觸發Ajax
var isLoading = false;
$(window).scroll(function(){
if (!isLoading && $(window).scrollTop() + $(window).height() >= $(document).height() - bottom){
//if (!isLoading && $(window).scrollTop() + screen.height >= $(document).height() - bottom){
isLoading = true;
doSomeThing();
}
});
function doSomeThing(){
// show loading icon
$("#loadingIcon").show();
$.ajax({
method: "POST",
url: "",
dataType: "json",
async: true,
data: {
},
cache: false,
success: function (data) {
//新增內容
$("#contentList").append(resultHTML);
//確認資料是否還有資料 是否要恢復Scroll事件
if( parseInt(count) > 0) {
isLoading = false;
// 取得資料索引遞增
AtPage++;
}
$("#loadingIcon").hide();
},
error: function () {
isLoading = false;
$("#loadingIcon").hide();
}
});
}
var bottom = parseInt ( $(window).height() / 10 );
//是否觸發Ajax
var isLoading = false;
$(window).scroll(function(){
if (!isLoading && $(window).scrollTop() + $(window).height() >= $(document).height() - bottom){
//if (!isLoading && $(window).scrollTop() + screen.height >= $(document).height() - bottom){
isLoading = true;
doSomeThing();
}
});
function doSomeThing(){
// show loading icon
$("#loadingIcon").show();
$.ajax({
method: "POST",
url: "",
dataType: "json",
async: true,
data: {
},
cache: false,
success: function (data) {
//新增內容
$("#contentList").append(resultHTML);
//確認資料是否還有資料 是否要恢復Scroll事件
if( parseInt(count) > 0) {
isLoading = false;
// 取得資料索引遞增
AtPage++;
}
$("#loadingIcon").hide();
},
error: function () {
isLoading = false;
$("#loadingIcon").hide();
}
});
}
2014年2月6日 星期四
呼叫 IFRAME內 的 html
<iframe id = "filePage" src="" style="width:825px;height:600px"></iframe>
$("#
filePage
").contents().find("#myContent")
2014年2月5日 星期三
檔案類型過濾
var ext = $('#my_file_field').val().split('.').pop().toLowerCase();
if($.inArray(ext, ['gif','png','jpg','jpeg']) == -1) {
alert('invalid extension!');
}
訂閱:
文章 (Atom)