select row_number() over(order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --直接排序
select row_number() over(partition by zip1 order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --單一群組內各自做排序
select rank() over(order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --同群組同號碼,下一群組跳號
select dense_rank() over(order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --同群組同號碼,下一群組接號
--------------------------------------------------------------------------------------------------
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, 0, getdate()), 0), 111) AS 本周一
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, 0, getdate()), 5), 111) AS 本周六
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, 6, getdate()), 0), 111) AS 上周一
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, -6, getdate()), 0), 111) AS 下周一
DECLARE @myDate as DATETIME
SET @myDate = DATEADD(week, DATEDIFF(week, 0, getdate()), 0)
SELECT CONVERT(VARCHAR(10),DATEADD(day, +5, @myDate),111) AS 本周六
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
client trigger server event:
function processKeyDown() {
var key = event.keyCode;
if (key == 13) {
//key == 9 ==> Tab Key==13==>Enter
__doPostBack('Do_Insert','');
event.returnValue = false;
}
}
<asp:TextBox ID="f_Chart_no" runat="server" onkeydown="processKeyDown()" OnTextChanged="f_Chart_no_OnTextChanged"
AutoPostBack="true"></asp:TextBox>
<asp:LinkButton ID="Do_Insert" runat="server"></asp:LinkButton>
Protected Sub Do_Insert_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Do_Insert.Click
--------------------------------------------------------------------------------------------------
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
alert("document is ready");
});
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
$(function(){
});
jQuery(document).ready(function(){
});
$(document).ready(function(){
});
--------------------------------------------------------------------------------------------------
jQuery
$( "Input[value='刪除'][class='btn btn-info']").removeClass( "btn btn-info" ).addClass( "btn btn-danger" );
$( "p" ).on( "mouseover", function() {
$( this ).css( "color", "red" );
});
$( "span" ).on( "click", function() {
$( this ).css( "background-color", "yellow" );
});
$('#student tr').each(function () {
$(this).dblclick(function () {
window.location = $(this).find('td').find('a').attr('href');
});
});
// 設定點Link 不作用
$('#student tr td a').click(function (e) {
e.preventDefault();
});
$('#student tr td a').dblclick(function (e) {
window.location.replace($(this).attr("href"));
});
$("#div1").find("tr").dblclick(function(){
window.open($(this).find("a").attr('href'), '_blank');
});
$(document).ready(function(){
$("#button1").click(function(){
alert($("#form1").find("input:nth-child(3)").val());
$("#form1").find("input:nth-child(3)").val("Hello");
});
$("#button2").click(function(){
alert($("#form1").children("input[id=c]").val());
$("#form1").children("input[id=c]").val("Hello");
});
});
$( "#clickme" ).click(function() {
$( "#book" ).show( "slow", function() {
// Animation complete.
});
});
$( "#hidr" ).click(function() {
$( "div" ).hide( 1000 );
});
$(function(){
$(".btn").click(function(e) {
var result1 = $(this).parents("tr").children("td:first").text();
var result2 = $(this).parents("tr").children("td:first").children("input").val();
//也可用td:eq()的方法找到指定的index位置
alert(result1 + '-' + result2);
});
});
$(document).shortkeys({
'r': function () { $("#txtReceptionBarcode").focus();}
});
$(document).ready(function(){
$("#txtReceptionBarcode").focus()
});
--------------------------------jQuery Ajax 2 .Net ashx-------------------------------------------
//js的部分
function genEvents(menuOroption,Item_value){
//宣告變數
var eventPulled = $('#calendar').fullCalendar('clientEvents');
var title;
var priority;
var index=menuOroption ;
var Event_id = Item_value;
var isPulledOrNot =0 ;
//組jason格式
var UpdateEvent = [{'index':index},{'Event_id':Event_id},{'reg_id':reg_id}];
var myJSON = JSON.stringify({ 'TheUpdateEvent': UpdateEvent });
var formData = new window.FormData();
formData.append('myJSON' , myJSON);
//console.log(myJSON);
$.ajax({
type: 'POST', //回Server的方式 (GET, POST)
//URL依據使用的ashx替換
url: 'BSbookingHandler.ashx', //ajax 要呼叫的位置 (可以是aspx,html,ashx,asmx )
data: formData, // 呼叫Server傳遞的參數
//dataType: 'text', //設定傳遞給Server參數的格式
processData : false ,
contentType: false , //設定Server傳回值格式
success: function (data) {
console.log("sucess genEvents : " + index + " " + Event_id );
},
error: function (data) {
console.log( "fail genEvents : " + index + " " + Event_id );
}
});
}
//ashx
Imports System.Web
Imports System.Web.Services
Imports System.IO
Imports System.Data
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
'context.Response.ContentType = "text/plain"
Dim jsonFromAjax As String = context.Request.Params("myJSON")
Dim jobj As JObject = New JObject
jobj = JsonConvert.DeserializeObject(Of JObject)(jsonFromAjax)
Dim index As String = jobj.Item("TheUpdateEvent").ElementAt(0).Item("index")
//傳回client的值
Dim valueTOclient As String
context.Response.Write(valueTOclient)
End Sub
--------------------------------------------------------------------------------------------------
Protected Sub Grid1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Grid1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim b As Button = CType(e.Row.FindControl("button1"), Button)
If Not b Is Nothing Then
If Grid1.DataKeys(e.Row.RowIndex).Values(0).ToString = "3" Then
b.BackColor = Drawing.Color.Red
b.Attributes.Add("onclick", "return false")
b.Style.Add("cursor", "text")
Else
b.BackColor = Drawing.Color.FromArgb(255, 230, 153)
b.Attributes.Add("onclick", "return false")
b.Style.Add("cursor", "text")
End If
End If
Dim hl As HyperLink = CType(e.Row.FindControl("HyperLink1"), HyperLink)
If Not hl Is Nothing Then
hl.Text = Grid1.DataKeys(e.Row.RowIndex).Values(1).ToString
hl.Style.Add("cursor", "pointer")
hl.Attributes.Add("onclick", " w = window.screen.availWidth * 95 / 100; h = window.screen.availHeight * 95 / 100; window.open('tracerMgrDetail.aspx?id=" & Grid1.DataKeys(e.Row.RowIndex).Values(2).ToString & "','HELPWIN','left=10,top=10,width='+w+',height='+h); ")
End If
End If
End Sub
--------------------------------------------------------------------------------------------------
select row_number() over(partition by zip1 order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --單一群組內各自做排序
select rank() over(order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --同群組同號碼,下一群組跳號
select dense_rank() over(order by zip1 asc) as tt ,zip1 from hc_cust where zip1 <> '' --同群組同號碼,下一群組接號
--------------------------------------------------------------------------------------------------
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, 0, getdate()), 0), 111) AS 本周一
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, 0, getdate()), 5), 111) AS 本周六
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, 6, getdate()), 0), 111) AS 上周一
SELECT CONVERT(VARCHAR(10), DATEADD(week, DATEDIFF(week, -6, getdate()), 0), 111) AS 下周一
DECLARE @myDate as DATETIME
SET @myDate = DATEADD(week, DATEDIFF(week, 0, getdate()), 0)
SELECT CONVERT(VARCHAR(10),DATEADD(day, +5, @myDate),111) AS 本周六
--------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
client trigger server event:
function processKeyDown() {
var key = event.keyCode;
if (key == 13) {
//key == 9 ==> Tab Key==13==>Enter
__doPostBack('Do_Insert','');
event.returnValue = false;
}
}
<asp:TextBox ID="f_Chart_no" runat="server" onkeydown="processKeyDown()" OnTextChanged="f_Chart_no_OnTextChanged"
AutoPostBack="true"></asp:TextBox>
<asp:LinkButton ID="Do_Insert" runat="server"></asp:LinkButton>
Protected Sub Do_Insert_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Do_Insert.Click
--------------------------------------------------------------------------------------------------
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
alert("document is ready");
});
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
$(function(){
});
jQuery(document).ready(function(){
});
$(document).ready(function(){
});
--------------------------------------------------------------------------------------------------
jQuery
$( "Input[value='刪除'][class='btn btn-info']").removeClass( "btn btn-info" ).addClass( "btn btn-danger" );
$( "p" ).on( "mouseover", function() {
$( this ).css( "color", "red" );
});
$( "span" ).on( "click", function() {
$( this ).css( "background-color", "yellow" );
});
$('#student tr').each(function () {
$(this).dblclick(function () {
window.location = $(this).find('td').find('a').attr('href');
});
});
// 設定點Link 不作用
$('#student tr td a').click(function (e) {
e.preventDefault();
});
$('#student tr td a').dblclick(function (e) {
window.location.replace($(this).attr("href"));
});
$("#div1").find("tr").dblclick(function(){
window.open($(this).find("a").attr('href'), '_blank');
});
$(document).ready(function(){
$("#button1").click(function(){
alert($("#form1").find("input:nth-child(3)").val());
$("#form1").find("input:nth-child(3)").val("Hello");
});
$("#button2").click(function(){
alert($("#form1").children("input[id=c]").val());
$("#form1").children("input[id=c]").val("Hello");
});
});
$( "#clickme" ).click(function() {
$( "#book" ).show( "slow", function() {
// Animation complete.
});
});
$( "#hidr" ).click(function() {
$( "div" ).hide( 1000 );
});
$(function(){
$(".btn").click(function(e) {
var result1 = $(this).parents("tr").children("td:first").text();
var result2 = $(this).parents("tr").children("td:first").children("input").val();
//也可用td:eq()的方法找到指定的index位置
alert(result1 + '-' + result2);
});
});
$(document).shortkeys({
'r': function () { $("#txtReceptionBarcode").focus();}
});
$(document).ready(function(){
$("#txtReceptionBarcode").focus()
});
--------------------------------jQuery Ajax 2 .Net ashx-------------------------------------------
//js的部分
function genEvents(menuOroption,Item_value){
//宣告變數
var eventPulled = $('#calendar').fullCalendar('clientEvents');
var title;
var priority;
var index=menuOroption ;
var Event_id = Item_value;
var isPulledOrNot =0 ;
//組jason格式
var UpdateEvent = [{'index':index},{'Event_id':Event_id},{'reg_id':reg_id}];
var myJSON = JSON.stringify({ 'TheUpdateEvent': UpdateEvent });
var formData = new window.FormData();
formData.append('myJSON' , myJSON);
//console.log(myJSON);
$.ajax({
type: 'POST', //回Server的方式 (GET, POST)
//URL依據使用的ashx替換
url: 'BSbookingHandler.ashx', //ajax 要呼叫的位置 (可以是aspx,html,ashx,asmx )
data: formData, // 呼叫Server傳遞的參數
//dataType: 'text', //設定傳遞給Server參數的格式
processData : false ,
contentType: false , //設定Server傳回值格式
success: function (data) {
console.log("sucess genEvents : " + index + " " + Event_id );
},
error: function (data) {
console.log( "fail genEvents : " + index + " " + Event_id );
}
});
}
//ashx
Imports System.Web
Imports System.Web.Services
Imports System.IO
Imports System.Data
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
'context.Response.ContentType = "text/plain"
Dim jsonFromAjax As String = context.Request.Params("myJSON")
Dim jobj As JObject = New JObject
jobj = JsonConvert.DeserializeObject(Of JObject)(jsonFromAjax)
Dim index As String = jobj.Item("TheUpdateEvent").ElementAt(0).Item("index")
//傳回client的值
Dim valueTOclient As String
context.Response.Write(valueTOclient)
End Sub
--------------------------------------------------------------------------------------------------
Protected Sub Grid1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Grid1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim b As Button = CType(e.Row.FindControl("button1"), Button)
If Not b Is Nothing Then
If Grid1.DataKeys(e.Row.RowIndex).Values(0).ToString = "3" Then
b.BackColor = Drawing.Color.Red
b.Attributes.Add("onclick", "return false")
b.Style.Add("cursor", "text")
Else
b.BackColor = Drawing.Color.FromArgb(255, 230, 153)
b.Attributes.Add("onclick", "return false")
b.Style.Add("cursor", "text")
End If
End If
Dim hl As HyperLink = CType(e.Row.FindControl("HyperLink1"), HyperLink)
If Not hl Is Nothing Then
hl.Text = Grid1.DataKeys(e.Row.RowIndex).Values(1).ToString
hl.Style.Add("cursor", "pointer")
hl.Attributes.Add("onclick", " w = window.screen.availWidth * 95 / 100; h = window.screen.availHeight * 95 / 100; window.open('tracerMgrDetail.aspx?id=" & Grid1.DataKeys(e.Row.RowIndex).Values(2).ToString & "','HELPWIN','left=10,top=10,width='+w+',height='+h); ")
End If
End If
End Sub
--------------------------------------------------------------------------------------------------