/// <summary> /// sql到C#的数据类型转换 /// </summary> /// <param name="typename">sql数据类型名称</param> /// <returns>C#名称</returns> public static string SqlToCsharp(string typename) { switch (typename) { case "bit": return "Boolean"; ... Read More
.net framework 中DateTime.MinValue => 0001/01/01 00:00:00DateTime.MaxValue => 9999/12/31 23:59:59.999SqlDateTime.MinValue.Value => 1753/01/01 00:00:00SqlDateTime.MaxValue.Value => 9999/12/31 23:59:59.997 (注意毫秒是997) sql server中:DateTime 最小值 => 1753/01/01 00:00:00SmallDateTime 最小值 => Read More
foreach (Control item in this.panel1.Controls){ if (string.IsNullOrEmpty(((TextBox)item).Text)) { this.label1.Text += ((TextBox)item).Name + "为空"; } }用扩展方法验证空字符串:namespace System{ public static class CheckStringEmpty { public static bool IsNullOrEmpty... Read More
--获取最小: --方法1:CREATE FUNCTION [dbo].[MinimumDateValue]()RETURNS DATETIMEASBEGIN RETURN CONVERT(DATETIME, '1753-01-01', 121)END --方法2: declare @Date smalldatetimeset @Date=0select @Date --获取最大 CREATE FUNCTION [dbo].[MaximumDateValue]()RETURNS DATETIMEASBEGIN RETURN CONVERT(DATETIME, '9999 Read More
CREATE FUNCTION dbo.fnSplit( @sInputList VARCHAR(8000), -- List of delimited items列表分隔的项目 @sDelimiter VARCHAR(8000) = ',' -- delimiter that separates items分隔符分隔的项目)RETURNS @List TABLE (item VARCHAR(8000))BEGINDECLARE @sItem VARCHAR(8000) WHILE CHARINDEX(@sDelimiter,@sInputList,0) <> 0 Read More
create proc sp_InsertSplite(@s text)asbegindeclare @str nvarchar(100)DECLARE CusCursor CURSOR FOR select col from dbo.f_splitStr(@s,';')OPEN CusCursorFETCH NEXT FROM CusCursor INTO @strWHILE (@@FETCH_STATUS = 0)BEGIN declare @start1 int,@start2 int declare @col1 varchar(50),@col2 nvarchar(50 Read More
DECLARE @MyCounter INTSET @MyCounter = 0 /*设置变量*/WHILE (@MyCounter < 1000000) /*设置循环次数*/BEGIN--WAITFOR DELAY '000:00:01' /*延迟时间10秒*/insert Test(TestValue) values(GETDATE())SET @MyCounter = @MyCounter + 1END Read More