This file contains 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
1.INSERT INTO SELECT语句 | |
语法: | |
Insert into Table2(field1,field2,...) select value1,value2,... from Table1 | |
要求目标表 Table2 必须存在,由于目标表 Table2 已经存在,所以我们除了插入源表 Table1 的字段外,还可以插入常量。示例如下: | |
INSERT INTO collector_cols (collector_id, account_level_id) | |
SELECT 14, NAME FROM collector_cols WHERE collector_id = ; | |
This file contains 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
const int STD_INPUT_HANDLE = -10; | |
const uint ENABLE_QUICK_EDIT_MODE = 0x0040; | |
[DllImport("kernel32.dll", SetLastError = true)] | |
internal static extern IntPtr GetStdHandle(int hConsoleHandle); | |
[DllImport("kernel32.dll", SetLastError = true)] | |
internal static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint mode); | |
[DllImport("kernel32.dll", SetLastError = true)] | |
internal static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint mode); |
This file contains 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
// 给新窗口七个名字叫"winName", 调用代码时如果tab页已存在,则将切换过去,并刷新页面 | |
var win = window.open('http://abc.com', 'winName'); |
This file contains 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
str = str.replace(/(?:\r\n|\r|\n)/g, '<br />'); |
This file contains 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
$("#message").keydown(function (e) { | |
if ((e.which === 13 && e.ctrlKey)) { | |
$(this).val(function (i, val) { | |
return val + "\n"; | |
}); | |
} | |
}).keypress(function (e) { | |
if (e.which === 13 && !e.ctrlKey) { | |
$('#btnSendMessage').click(); | |
e.preventDefault(); |
This file contains 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
/// <summary> | |
/// 将Guid作为种子生成随机数(同一个Guid生成相同的随机数) | |
/// </summary> | |
/// <param name="min">范围最小值</param> | |
/// <param name="max">范围最大值</param> | |
/// <param name="seedGuid">作为种子的Guid值</param> | |
/// <returns>生成的随机数</returns> | |
public static int GetRandomNumber(int min, int max, Guid seedGuid) | |
{ | |
byte[] buffer = seedGuid.ToByteArray(); |
This file contains 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.Configuration; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace SevenStarCollect.Update |
This file contains 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
// ASP.NET WebForm,ASP.NET MVC | |
var sPath = Server.MapPath("/FilePath/"); | |
// ASP.NET WebAPI | |
// 当 WebAPI 寄宿在非IIS下时(如自寄宿),无法访问HttpContext类,因此要调用这个方法来获取虚拟路径的实际磁盘路径 | |
var sPath = System.Web.Hosting.HostingEnvironment.MapPath("/FilePath/"); |
This file contains 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
//ViewModel | |
public class BindViewModel : NotificationObject | |
{ | |
public Action CloseAction = null; | |
/// <summary> | |
/// 退出 | |
/// </summary> | |
public ICommand CloseCommand => new DelegateCommand(() => | |
{ |
This file contains 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
<Button | |
x:Name="btnMain" | |
Command="infra:ApplicationCommands.MyCommand" | |
CommandParameter="{Binding}" | |
/> |