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>="
Ïà¹ØÎĵµ£º
±¾ÕÂΪ½Ó¿Ú¿Î³ÌµÄ×ÛºÏÁ·Ï°¡£
±¾´ÎÁ·Ï°Õ¹Ê¾ÁËÒ»¸ö¼ò»¯µÄÒøÐÐÒµÎñÁ÷³Ì£¬ÌåÏÖÁËÒøÐкÍÓû§Êý¸ö½ÇÉ«µÄ¹Øϵ¡£¿´ÏÂͼ£º
ÕË»§ÀࣨAccount£©¶ÔÏó´æ´¢ÔÚÊý¾Ý¿âÀࣨDatabase£©¶ÔÏóÖУ»¼ÆËã»ú£¨Computer£©Àà¶ÔÏóÁ¬½Óµ½Êý¾Ý¿âÀà¶ÔÏóÉÏ£»ÒøÐйñ̨£¨BankCounter£©Àà¶ÔÏóÓµÓÐһ̨¼ÆËã»ú¶ÔÏó×÷Ϊ˽ÓгÉÔ±£¬ÀûÓøöÔÏó¶ÔÊý¾Ý¿â½øÐвÙ×÷£»AT ......
¡¾ÆªÊ×Óï¡¿Æäʵ±¾ÎĽéÉܵķ½·¨ÊÇÒ»¸ö˼·£¬µ«ÊÇÎҸоõ°ÉÎÊÌâ¸ã¸´ÔÓÁË¡£ÀÏÍâµÄÕâ¸öC#µ÷ÓÃC++µÄdll·½Ê½Í¦ºÃµÄ£¬Ò²ºÜÎȶ¨£¬¿ÉÒÔ¿´¿´http://www.codeproject.com/KB/cs/DynamicInvokeCSharp.aspx¡£
Õª Òª£ºÔÚ¡¶csdn¿ª·¢¸ßÊÖ¡·2004ÄêµÚ03ÆÚÖеġ¶»¯¹¦´ó·¨ ——½«DLLǶÈëEXE¡·Ò»ÎÄ£¬½éÉÜÁËÈçºÎ°ÑÒ»¸ö¶¯Ì¬Á´½Ó¿â×÷Ϊһ¸ ......
c#ÖÐÁ½ÖÖ²ÎÊý´«µÝ·½Ê½£¬refºÍ·Çref£¬Ò»Ð©ÈË»á¾õµÃÊÇ·ñ²ÉÓÃref´«µÝ»áÓиü¸ßµÄЧÂÊ£¬Êµ¼ÊÄØ£¿ÏÂÃæ·Ö±ð¿´Ï¡£
1¡¢ÖµÀàÐͲÎÊývoid FuncA(int iArg1,double dArg1,ref int iArg2,ref double dArg2)¡£
iArg1ºÍdArg1²»¼Óref£¬´ËʱµÄÈ·»áÔÚÕ»À�±´Ò»·ÝÖµ£¬µ«Í¬Ê ......