SQL clr - MS-SQL Server / ·Ç¼¼Êõ°æ
ÏëÓÃSQL CLR×öÈçϵĴ洢¹ý³Ì,µ«ÊÇ·¢ÏÖ±¨´í:
{ÓÉÓÚ´úÂëÒѾ¹ýÓÅ»¯»òÕß±¾»ú¿ò¼ÜλÓÚµ÷ÓöÑÕ»Ö®ÉÏ£¬ÎÞ·¨¼ÆËã±í´ïʽµÄÖµ¡£}
¶øÇÒÈç¹ûÊý¾Ý´Ócase 1ͨ¹ýʱ¾ÍÊÇÕýÈ·µÄ,´Ócase 2ͨ¹ýʱ´íÎó
²¢ÇÒÔÚcase 2ÖеÄmyCommand.CommandTextºóÈç¹ûÊǸöselectÓï¾ä¾ÍÊÇÕýÈ·µÄ,µ«ÊÇÔËÐд洢¹ý³Ì¾Íͨ²»¹ý,¶øÇÒµ¥¶À²âÊÔ´æ´¢¹ý³ÌÊÇÕýÈ·µÄ,ºÃÏñÎÊÌâÊdzöÔÚrecordµÄ·¢ËÍÉÏ,Çó½Ì!
[SqlProcedure]
public static void procClr(SqlXml sx)
{
XPathDocument doc = new XPathDocument(sx.CreateReader());
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator i = nav.Select(@"/NewDataSet/StandardDT");
SqlDataRecord record =new SqlDataRecord(new SqlMetaData("i_num", SqlDbType.Int));
SqlPipe sp = SqlContext.Pipe;
sp.SendResultsStart(record);
while (i.MoveNext())
{
//----½âÎöXMLÊý¾Ý----
int inum=Convert.ToInt32(i.Current.Evaluate("string(i_num[1]/text())"));
//-----´¦ÀíÊý¾Ý------
int flag=Function(inum);//×Ô¶¨Ò庯Êý,ÎÞÎó
switch(flag)
{
case 1:
{
record.SetValues(1);
break;
}
case 2:
{
using (SqlConnection myConnection = new S
Ïà¹ØÎÊ´ð£º
ÇëÎÊһϣ¬ÍâÍøÁ½Ì¨SQLSERVERʵÀýÊý¾Ý´«Ê䣬ÓÐûÓвÉÓÃÊý¾ÝѹËõºÍ¼ÓÃÜ¡£Ñ¹Ëõ±ÈÊǶàÉÙ£¬¼ÓÃÜÊÇʲô¼ÓÃÜËã·¨£¿Ïà¹ØÎĵµÄÄÀï¿ÉÒÔÕÒµ½£¿Ð»Ð»
ÎÒÒ²ÏëÖªµÀ£¡¹Ø×¢´ËÌù£¡
¹Ø×¢¡«¡«
Êý¾Ý¿â´óÅ£¶¼ÄÄÈ¥ÁË°¡£¿
......
protected void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......
СµÜ£¬×î½üҪתÐÐÈ¥×öoracle¿ª·¢ÁË£¬ÓÉÓÚ´óѧ±Ïҵʱ£¬×ßÁ˸öÍä·£¬ÏÖÔÚºÜСÐÄ£¬ÎÊÏ£¬×öPL/SQLÓÐûÓÐǰ;£¿£¿£¿
µ±È»ÎÒ˵µÄÕâ¸öǰ;ÊÇÖ¸ ÒÔºóÒªÌø²Û£¬Êг¡¶ÔÕâÑùµÄÈ˲ŵÄÐèÇóÁ¿´ó²»´ó£¿£¿
3q ÄÇ¿´À´»¹Ö»ÄÜÏȽӴ ......
ÎÒÃÇC#×öÒ»¸ö´°Ìå ÍùÊý¾Ý¿âÀï²åÈëÊý¾Ý
SqlConnection cn = new SqlConnection("Data Source=20090713-1752\\SQLEXPRESS;Initial Catalog=goods;Integrated Security=True");
......
ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄÇ°2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......