用vs2005开发存储过程遇到的数据库连接失败的问题
创建过程参考msdn和cnblogs.com的文章步骤 
 http://www.cnblogs.com/ugoer/archive/2005/04/01/129986.html 
 (本机未装sqlserver2005,我在sqlexpress上建立的表)   
 稍微修改了下代码: 
 using   System;    
 using   System.Data;    
 using   System.Data.Sql;    
 using   System.Data.SqlServer;    
 using   System.Data.SqlTypes;              
 public   partial   class   StoredProcedures    
 {    
             [SqlProcedure]    
             public   static   void   Hello()    
             {    
                         SqlContext.GetPipe().Send( "hello   ,uGoer! ");    
             }         
             [SqlProcedure]    
             public   static   void   InsertData(SqlString   name)    
             {    
                         SqlCommand   InsertCurrencyCommand   =   SqlContext.GetCommand();   //   修改部分,原为SqlContext.GetCommand()方法; 
                         InsertCurrencyCommand.CommandText   =    "INSERT   INTO   table1   (Name,   addDate)   VALUES   ( ' "+name.Value+ " ',    ' "   +   DateTime.Now.ToString()   +    " ') ";    
                         InsertCurrencyCommand.ExecuteNonQuery();    
             }         
             [SqlFunction]    
             public   static   SqlString   testFunction()    
             {    
                         return    "hello   ,   cnBlogs.com ";    
             }    
 };      
 然后部署存储过程,在测试的时候前面的那个执行成功,而后面的方法执行未成功,是什么原因呢(Connection   property   has   not   been   initialized) 
 错误: 
 Auto-attach   to   process    '[472]   sqlservr.exe '   on   machine    'cec-jcd '   succeeded. 
  'sqlservr.exe '   (Managed):   Loaded    'C:\WINNT\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll ',   Skipped   loading   symbols.   Module   is   optimized   and   the   debugger   option    'Just   My   Code '   is   enabled. 
  'sqlservr.exe '   (Managed):   Loaded    'C:\Program   Files\Microsoft   SQL   Server\MSSQL.1\MSSQL\Binn\SqlAccess.dll ',   Skipped   loading   symbols.   Module   is   optimized   and   the   debugger   option    'Just   My   Code '   is   enabled. 
  'sqlservr.exe '   (Managed):   Loaded    'C:\WINNT\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll ',   Skipped   loading   symbols.   Module   is   optimized   and   the   debugger   option    'Just   My   Code '   is   enabled. 
  'sqlservr.exe '   (Managed):   Loaded    'C:\WINNT\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll ',   Skipped   loading   symbols.   Module   is   optimized   and   the   debugger   option    'Just   My   Code '   is   enabled.