SELECT ROW_NUMBER() OVER(ORDER BY [排名欄位] ) AS RNO FROM [資料表]
範例
SELECT ROW_NUMBER() OVER(ORDER BY [Sno] DESC) AS RNO FROM [TableName]
分享 ASP,ASP.NET,VB,C#,程式開發,網站設計,部落格,微網誌,網路行銷,facebook 行銷,噗浪行銷,社群行銷,電腦硬體軟體,網路賺錢等資訊內容。『噗落格』裡的文章大多是從各網站摘錄(轉貼)下來的,僅提供研究及筆記之用途,如有侵權請留言告知!一開始不打算賺錢,一個不可能中的可能
SELECT ROW_NUMBER() OVER(ORDER BY [排名欄位] ) AS RNO FROM [資料表]
SELECT ROW_NUMBER() OVER(ORDER BY [Sno] DESC) AS RNO FROM [TableName]
<head>
<script type="text/javascript" src="blah.js"></script>
<link src="blah.css" type="text/css" ref="stylesheet"></link>
</head>
var headID = document.getElementsByTagName("head")[0];
var newCss = document.createElement('link');
newCss.type = 'text/css';
newCss.rel = "stylesheet";
newCss.href = "blah.css";
headID.appendChild(newCss);
var newJs = document.createElement('script');
newJs .type = 'text/javascript';
newJs .src= "blah.js";
headID.appendChild(newJs);
function padLeft(str, lenght) { //左邊補0
if (str.length >= lenght)
return str;
else
return padLeft("0" + str, lenght);
}
function padRight(str, lenght) { //右邊補0
if (str.length >= lenght)
return str;
else
return padRight(str + "0", lenght);
}
var numkey = padLeft("10", 4);
alert(numkey);
$("div").addClass("special");
$("a[target]").append(" (Opens in New Window)");
jsGears
Amazon
jsGears
Google (Opens in New Window)
Amazon (Opens in New Window)
$("#body").css({
border: "1px solid green",
height: "40px"
});
...
...
$("form").submit(function() {
if ($("input#username").val() == "")
$("span.help").show();
});
$("a#open").click(function() {
$("#menu").show();
return false;
});
控制面板
$("#menu").slideDown("fast");
$("div").animate({
width: '300px',
padding: '20px'
}, 'slow');
Hello world!
$("div").hide(500, function(){
// $(this) 是每一個各別的 <div>
$(this).show(500);
});
Hello world!
jsGears.com!
$("#body").load("sample.html div > h1");
Hello world!
This is H2
jsGears.com!
Hello world!
jsGears.com!
$.getJSON("test.json", function(data){
for (var idx in data)
$("#menu").append("
[
"Hello world!",
"jsGears.com!"
]
onclick="addition('DivSh_Year');"
onclick="addition(DivSh_Year);"
body{font-family:Arial, Helvetica, sans-serif;}
ul ,li{ margin:0; padding:0; list-style-type: none; float:left;}
#showbox{width:360px; border:solid 1px #eee;}
#showImg , #showImg table{width:360px; height:300px;}
#imgList{margin-top:10px; margin-left:3px; padding-bottom:10px; overflow:auto;}
#imgList span{float:left; display:block; width:22px; margin:2px; line-height:50px;}
#list{position:relative; float:left; width:350px; height:60px;}
#list img{width:40px; height:40px;}
#list{width:300px; float:left; margin:0 2px; overflow:hidden;}
#list ul{ position:absolute; left:0; top:0; white-space: nowrap;/* 不斷行 */}
#list ul li{
display: inline; /* 水平排列 */
margin:0 4px;
padding:5px;
border:solid 1px #eee;
}
#list ul li.on{border:solid 2px #ccc;}
#list ul li img {display: inline-block; /* 水平內顯示為區塊 */}
/* 秀大圖 */
#imgB{border:solid 7px #fff;}
/* 滑入顯示圖片區塊 */
#overImg{position:absolute; top:-99999; left:-99999; display:none; z-index:100; border:solid 5px #666; padding:5px; background:#fff;}
$.fn.showElemId = function(bgc, fc) {
return this.each(function() {
var $elem = $(this);
//if (!$elem.is(":visible")) return;
var pos = $elem.offset();
var html = "" +
(this.id || "----") +
"";
$("body").append(html);
});
};
/* 使用範例: $(":text,select").showElemId(); */
$(window).error(function(msg, url, line){
jQuery.post("/js_error_log.ashx", { msg: msg, url: url, line: line });
});
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CustIDName.ascx.cs" Inherits="UserControl_CustIDName" %>
<%@ Register Assembly="Joey" Namespace="Joey" TagPrefix="cc1" %>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class UserControl_CustIDName : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string CustID
{
get
{ return this.JoeyTextBox1.mTextBox.Text; }
set
{ this.JoeyTextBox1.mTextBox.Text = value; }
}
public string CustName
{
get
{ return this.JoeyTextBox2.mTextBox.Text; }
set
{ this.JoeyTextBox2.mTextBox.Text = value; }
}
public string ValidationGroup
{
get
{ return this.JoeyTextBox1.ValidationGroup; }
set
{
this.JoeyTextBox1.ValidationGroup = value;
this.JoeyTextBox2.ValidationGroup = value;
}
}
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class LoopAddUserControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.DropDownList1.Items.Add(new ListItem("user control index"));
for (int i = 0; i < 10; i++)
{
this.DropDownList1.Items.Add(new ListItem(i.ToString()));
}
}
for (int index = 0; index < 10; index++)
{
Control ctlNewTrial = this.Page.LoadControl("UserControl/CustIDName.ascx");
SetUserControlProperty(ctlNewTrial, "ID", "Usrctrl" + index.ToString());
SetUserControlProperty(ctlNewTrial, "CustID", index.ToString());
SetUserControlProperty(ctlNewTrial, "CustName", index.ToString()+":name");
this.Panel1.Controls.Add(ctlNewTrial);
Label br = new Label();
br.Text = "index=" + index.ToString()+ "
";
this.Panel1.Controls.Add(ctlNewTrial);
this.Panel1.Controls.Add(br);
}
}
///
/// 設定user control的屬性值
///
/// usercontrol by page.loadcontrol()
/// usercontrol's property
/// setting property value
///
public void SetUserControlProperty(Control vobjControl, string vstrPropertyName, object vobjValue)
{
vobjControl.GetType().GetProperty(vstrPropertyName).SetValue(vobjControl, vobjValue, null);
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
ASP.usercontrol_custidname_ascx usrctl1 = (ASP.usercontrol_custidname_ascx)this.Panel1.FindControl("Usrctrl" + this.DropDownList1.SelectedValue);
if (usrctl1 != null)
{
this.TextBox1.Text = usrctl1.CustID;
this.TextBox2.Text = usrctl1.CustName;
}
else
{
this.TextBox1.Text = string.Empty;
this.TextBox2.Text = string.Empty;
}
}
}