摘要: 代码 1 if exists(select * from sysobjects where name='CustomDate') 2 drop function dbo.CustomDate 3 go 4 create function dbo.CustomDate 5 ( 6 @time datetime='', 7 @year varchar(5) ='', 8 @month varchar(5) ='', 9 @day varchar(5) ='',10 @hour varchar(5) ='' 阅读全文
posted @ 2011-12-02 13:57 幸福~伞 阅读(296) 评论(0) 推荐(0) 编辑
摘要: View Code 1 create login stu with password='1111', default_database=stuInfo2 use stuInfo3 go4 create user stu for login stu with default_schema=dbo ;5 go 6 exec sp_addrolemember 'db_owner', 'stu' ;7 go要想成功访问 SQL Server 数据库中的数据,我们需要两个方面的授权:一、获得准许连接 SQL Server 服务器的权利;二、获得访问特定数据 阅读全文
posted @ 2011-11-24 17:11 幸福~伞 阅读(3455) 评论(0) 推荐(1) 编辑
摘要: 代码 1 ///<summary> 2 /// 在指定的字符串列表CnStr中检索符合拼音索引字符串 3 ///</summary> 4 ///<param name="CnStr">汉字字符串</param> 5 ///<returns>相对应的汉语拼音首字母串</returns> 6 public static string GetSpellCode(string CnStr) 7 { 8 string strTemp=""; 9 int iLen=CnStr.Length; 1 阅读全文
posted @ 2011-11-24 15:14 幸福~伞 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 1 ------------------------------------sql server 版本------------------------------------------ 2 -- 3 -- Definition for user-defined function f_GetPy : 4 -- 5 GO 6 create function [dbo].f_GetPy(@str nvarchar(4000)) 7 returns nvarchar(4000) 8 as 9 begin 10 declare @strlen in... 阅读全文
posted @ 2011-11-23 10:22 幸福~伞 阅读(459) 评论(0) 推荐(0) 编辑
摘要: 1 Sql Server 中一个非常强大的日期格式化函数常用: 2 Select CONVERT(varchar(100), GETDATE(), 23): 2006-05-16 3 Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM 4 Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06 5 Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16 6 Select CONVERT(varchar(100)... 阅读全文
posted @ 2011-11-07 22:48 幸福~伞 阅读(402) 评论(0) 推荐(0) 编辑
摘要: /*过滤掉的信息包括html的任何标签和属性*/ 1 public static string ClearHtmlCode(string text) 2 { 3 text = text.Trim(); 4 if (string.IsNullOrEmpty(text)) 5 return string.Empty; 6 text = Regex.Replace(text, "[/s]{2,}", ""); //过滤两个或两个以上的空格 7 tex... 阅读全文
posted @ 2011-11-05 10:01 幸福~伞 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 1 private static string Conversion(string binarySystem)2 {3 string er = binarySystem;4 int shi = Convert.ToInt32(er, 2);5 string shiliu = Convert.ToString(shi, 16);6 return shiliu;7 } 阅读全文
posted @ 2011-11-05 09:52 幸福~伞 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.Text.RegularExpressions; 5 using System.Management; 6 7 namespace ipInfo 8 { 9 class Program10 {11 static void Main(string[] args)12 { //获得主机名13 string hostname = Syste... 阅读全文
posted @ 2011-11-05 09:50 幸福~伞 阅读(553) 评论(0) 推荐(0) 编辑
摘要: API函数是构筑Windows应用程序的基石,是Windows编程的必备利器。每一种Windows应用程序开发工具都提供了间接或直接调用了WindowsAPI函数的方法,或者是调用WindowsAPI函数的接口,也就是说具备调用动态连接库的能力。Visual C#和其它开发工具一样也能够调用动态链接库的API函数。本文中笔者就结合实例向大家介绍在Visual C#中如何调用各种返回值的API,该实例就是一个通过API函数调用获取系统信息的程序。在Visual C#中调用API的基本过程:首先,在调用API之前,你必须先导入System.Runtime.InteropServices这个名称空间 阅读全文
posted @ 2011-11-05 09:41 幸福~伞 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 所谓系统信息,就是计算机的软件硬件信息,硬件如CPU主频、网卡名称等,软件信息就如操作系统目录,用户目录等。在平常的编程中,我们往往要用到这些系统信息,比如字体查看器,如果要写个C#版,则首先要获得系统字体的安装目录。总之,读取系统信息对于编程还是很重要的,.NET也不负所望,提供了很便利的方法,本文提供了四种方法来从各个方面对系统信息进行读取。第一种方法:用SystemInformation类SystemInformation提供静态方法和属性,它们可用于获取诸如Windows显示元素大小、操作系统设置、网络可用性和系统中所安装硬件的性能等信息,这种方法侧重于操作系统(这里特指Windows 阅读全文
posted @ 2011-11-05 09:32 幸福~伞 阅读(598) 评论(0) 推荐(0) 编辑