This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 查看連線數 | |
| USE master | |
| SELECT cntr_value AS User_Connections FROM sys.sysperfinfo AS sp | |
| WHERE sp.object_name='SQLServer:General Statistics' | |
| AND sp.counter_name='User Connections' | |
| GO | |
| -- 查看連線明細 | |
| USE master | |
| SELECT c.session_id, c.connect_time, s.login_time, c.client_net_address, s.login_name, s.status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Data.SqlClient; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| using Your.DB; | |
| public class YourDataService | |
| { | |
| // for DI injection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Text.Json; | |
| var foo = new { ... }; | |
| string json = JsonSerializer.Serialize(foo, new JsonSerializerOptions { | |
| Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping, // 中文字不編碼 | |
| WriteIndented = true // 換行與縮排 | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Mapster; | |
| using System; | |
| using System.Text.Json; | |
| //※ 這裡使用了一些 C# 9.0 的語法 | |
| namespace ConsoleApp1 | |
| { | |
| class Program | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// | |
| /// C# 9.0 後支援 immutable object 語法。 | |
| /// ref→[記錄類型](https://docs.microsoft.com/zh-tw/dotnet/csharp/whats-new/csharp-9#record-types) | |
| /// ref→[Record types](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9#record-types) | |
| /// ref→[Introducing C# 9: Records](https://morioh.com/p/8bb2b55e618d) | |
| /// | |
| using System; | |
| class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace LineBotConsole | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| String channelAccessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...."; | |
| String userId = "SomeOneLineId0123456789abcdef0123"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// | |
| /// ref→[LIFF v2 基本使用筆記及範例](https://www.letswrite.tw/liff-init/) | |
| /// | |
| import './App.css'; | |
| import { useEffect, useState } from 'react'; | |
| import liff from '@line/liff' | |
| const liffId = 'YOUR_REGISTERED_LIFF_ID'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @model IEnumerable<YOUR_FORM_ATTACH> | |
| <table class="table"> | |
| <tr> | |
| <th> | |
| @Html.DisplayNameFor(m => Model.FirstOrDefault().SN) | |
| </th> | |
| <th> | |
| @Html.DisplayNameFor(m => Model.FirstOrDefault().AttachName) | |
| </th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var qryDispN1 = db.消耗品登記表.Where(c => c.消耗品領用表.Count() == 0); | |
| var qryDispN2 = db.消耗品領用表 | |
| .GroupBy(d => d.帳卡編號) | |
| .SelectMany(g => g.OrderByDescending(d => d.序號).Take(1), (g, d) => d) // 選取分群後最新一筆明細(序號最大那筆明細)。 | |
| .Where(d => d.繳回日期.HasValue) | |
| .Select(d => d.消耗品登記表); | |
| qry = qryDispN1.Union(qryDispN2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using PagedList; | |
| namespace YourProject.Controllers | |
| { | |
| public class ComputerController : Controller | |
| { | |
| private MineDBEntities db = new MineDBEntities(); | |
| // GET: Computer | |
| public ActionResult Index(int? page) |