/// <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
posted @ 2013-02-18 15:48 一抹、思乡泪 Views(473) Comments(0) Diggs(0) Edit
.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
posted @ 2013-02-18 15:48 一抹、思乡泪 Views(233) Comments(0) Diggs(0) Edit
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
posted @ 2013-02-18 15:47 一抹、思乡泪 Views(478) Comments(0) Diggs(0) Edit
--获取最小: --方法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
posted @ 2013-02-18 15:44 一抹、思乡泪 Views(8256) Comments(0) Diggs(0) Edit
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
posted @ 2013-02-18 15:43 一抹、思乡泪 Views(329) Comments(0) Diggs(0) Edit
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
posted @ 2013-02-18 15:42 一抹、思乡泪 Views(265) Comments(0) Diggs(0) Edit
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
posted @ 2013-02-18 15:41 一抹、思乡泪 Views(150) Comments(0) Diggs(0) Edit