.net宏

        System.Int32 returnValue = default(System.Int32);
            
if(tm!=null)
            {
#if DEBUG
                
try
                {
#endif
                    
object tempObj=SqlHelper.ExecuteScalar(tm.SqlTransaction, this.SqlStruct.CommandType, this.SqlStruct.CommandText, this.SqlStruct.SqlParameters);
                    
if(tempObj!=null)
                        returnValue 
= Convert.ToInt32(tempObj);
#if DEBUG
                }
                
catch (Exception err)
                {
                    DataBaseLogArgs args 
= new DataBaseLogArgs();
                    args.ExceptionDetails 
= err.ToString();
                    args.CommandText 
= this.SqlStruct.CommandText;
                    args.CommandType 
= this.SqlStruct.CommandType;
                    args.DateTime 
= DateTime.Now;
                    args.Command 
= "ExecuteNonQuery";
                    args.LogType 
= LogType.Error;
                    args.SqlParameter 
= this.SqlStruct.SqlParameters;
                    Log.Log.WriteLog(args);
                    
throw;
                }
#endif                  

            }
            
else
            {
                
object tempObj=SqlHelper.ExecuteScalar(this.connectStringReadAndWrite, this.SqlStruct.CommandType, this.SqlStruct.CommandText, this.SqlStruct.SqlParameters);
                
if(tempObj!=null)
                    returnValue
= Convert.ToInt32(tempObj);
            }

 

posted @ 2009-07-17 13:10  awp110  阅读(213)  评论(0编辑  收藏  举报