Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C# ±àдSQL SERVER 2005 µÄ´æ´¢¹ý³Ì


ÒÔÏÂÊÇÒ»¸ö²éѯIPµØÖ·¹éÊôµØµÄCLR´æ´¢¹ý³Ì£¬Èý²½£º
1¡¢ÓÃC#À´×öDLL£¬´úÂëÈçÏ£º
//====================================================================
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.SqlServer.Server;
public class AddrInfo
{
    [Microsoft.SqlServer.Server.SqlProcedure]
    public static void getAddrInfo(SqlString ip, out SqlString info)
    {
        using (SqlConnection connection = new SqlConnection("context connection=true"))
        {
            //IPµØÖ·×ªÎªÊý×Ö
            string[] tmp = ip.Value.Split(new string[]{"."},StringSplitOptions.None);
            Int64 ipn = ToInt(ToBinary(tmp[0]) + ToBinary(tmp[1]) + ToBinary(tmp[2]) + ToBinary(tmp[3]));
            connection.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = connection;
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "select addr_info from CZIP where ipn1<="
                                + ipn.ToString() + " and ipn2>="
                            


Ïà¹ØÎĵµ£º

Sql Server »ù´¡

Èí¼þ £º Sql Server 2005
 
    ÕâÀï²¢²»ÊÇSQLÓï·¨´óÈ«£¬ÒÔÏÂÊdz£ÓõÄÓï¾ä£¬¶Ô£¨Êý¾Ý¿â¡¢±í¡¢×ֶΡ¢Êý¾Ý£©µÄÔöɾ¸Ä²é£¬Èç¹ûÐèÒªÏêÏ¸È«ÃæµÄTransact-SQLÓï¾ä£¬¿ÉÒÔ²éSql ServerÁª»ú´ÔÊ飬ÄÇÀïÊÇ×îÈ«µÄ×ÊÁÏ£¬Ò»°ã°²×°Sql Server¶¼»áĬÈϰ²×°¡£
´ò¿ªSql ServerÁª»ú´ÔÊé
¿ªÊ¼ à ³ÌÐò à&n ......

ASP.NETÑéÖ¤Âë(C#)

* Copyright all(c) 2005 ZhongFeng, http://blog.csdn.net/SW515 */
 public class ValidateCode : System.Web.UI.Page
 {
  private void Page_Load(object sender, System.EventArgs e)
  {
   this.CreateCheckCodeImage(GenerateCheckCode());
  }
&nb ......

C#ÖеÄ==,!=µÈ·ûºÅÖØÔØ£¬ÒÔ¼°ÖØÔصȺŲÙ×÷

ͨ¹ýÒ»¸öʵ¼ÊµÄÀý×ÓÀ´½éÉÜ¡£ÆäÖÐÖØÔØ==£¬!=,Equal,GetHashCodeº¯Êý¡£
public class Record
{
public string[] arr = null;
public bool hasEqual = false;
//ÖØÔØÒ»¸öϱêÔËËã·ûºÅ
public string this[int index]
{
get
{
return arr[index];
}
set
{
arr[index] = value;
}
}
public override int GetHas ......

c# ref²ÎÊý´«µÝÕæÃæÄ¿

   c#ÖÐÁ½ÖÖ²ÎÊý´«µÝ·½Ê½£¬refºÍ·Çref£¬Ò»Ð©ÈË»á¾õµÃÊÇ·ñ²ÉÓÃref´«µÝ»áÓиü¸ßµÄЧÂÊ£¬Êµ¼ÊÄØ£¿ÏÂÃæ·Ö±ð¿´Ï¡£
   1¡¢ÖµÀàÐͲÎÊývoid FuncA(int iArg1,double dArg1,ref int iArg2,ref double dArg2)¡£
       iArg1ºÍdArg1²»¼Óref£¬´ËʱµÄÈ·»áÔÚÕ»À�±´Ò»·ÝÖµ£¬µ«Í¬Ê ......

ÔÚSQL Server 2005 ÖÐʹÓÃ.net³ÌÐò¼¯µÄÒ»Ïî×¢Òâ

ÔÚʹÓÃCLR´æ´¢¹ý³ÌÖÐÓöµ½µÄһЩÎÊÌ⣬ÔÚÕâÀï½øÐмǼ£º
´ò¿ªCLRµÄÖ§³Ö
--ÔÚSql ServerÖÐÖ´ÐÐÕâ¶Î´úÂë¿ÉÒÔ¿ªÆôCLR
exec sp_configure 'show advanced options', '1';
go
reconfigure;
go
exec sp_configure 'clr enabled', '1'
go
reconfigure;
exec sp_c ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ