n;
                command.CommandText = sSQL;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandTimeout = 1024;
int Active = 0;

                if (chkActive.Checked == true)
                {
                    Active = 1;
                }
                else
                {

                }

                if (currentFileName!= FileName)
                {
                    // Split entire file path to grab filename
                    string[] split = txtUploadStatus.Text.Split(new char[] { '\\' });
                    FileName = split[06];
                }
                else
                {
                    FileName = txtUploadStatus.Text;
                }

                command.Parameters.AddWithValue("@p_image_id", ImgID);
                command.Parameters.AddWithValue("@p_filename", FileName);
                command.Parameters.AddWithValue("@p_Active", Active);
                command.Parameters.AddWithValue("@p_url", txtUrl.Text);
                command.Parameters.AddWithValue("@p_Title", txtImgTitle.Text);
                command.Parameters.AddWithValue("@p_alt_text", txtAlt.Text);
                int rowsAffected = command.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
               // throw ex;

                //If it failed for whatever reason, rollback the //transaction
                //tn.Rollback();                          
                //No need to throw because we are at a top level call and //nothing is handling exceptions
                result = ex.InnerException.Message;
            }

Stored Procedure
USE [smsdb_test_griffin2]
GO
/****** Object:  StoredProcedure [dbo].[usp_imageloader_update]    Script Date: 01/09/2012    08:52:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER    procedure [dbo].[usp_imageloader_update]
@p_image_id INT,
@p_filename VARCHAR(100),
@p_Active TINYINT,
@p_url  VARCHAR(255),
@p_Title VARCHAR(100),
n; 
                 command. CommandText = sSQL; 
                 command. CommandType = CommandType. StoredProcedure; 
                 command. CommandTimeout = 1024; 
 int Active = 0; 

                 if (chkActive. Checked = = genuine) 
                 { 
                     Active = 1; 
                 } 
                 else 
                 { 

                 } 

                 if (currentFileName!= FileName) 
                 { 
                     // disconnected entire file path to catch filename 
                     drawstring [ ] split = txtUploadStatus. Text. Split(new char [ ] {' \\' }); 
                     FileName = split[06 ]; 
                 } 
                 else 
                 { 
                     FileName = txtUploadStatus. textbook; 
                 } 

                 command. Parameters. AddWithValue("@p_image_id ", ImgID); 
                 command. parameter. AddWithValue("@p_filename ", FileName); 
                 command. Parameters. AddWithValue("@p_Active ", Active); 
                 instruction. Parameters. AddWithValue("@p_url ", txtUrl. Text); 
                 command. Parameters. AddWithValue("@p_Title ", txtImgTitle. textbook); 
                 command. Parameters. AddWithValue("@p_alt_text ", txtAlt. textbook); 
                 int rowsAffected = command. ExecuteNonQuery (); 
             } 
             apprehension (SqlException ex-husband) 
             { 
                // throw ex; 

                 //If it failed for whatever reason, rollback the //transaction 
                 //tn. Rollback ();                          
                 //No want to throw because we are at a top level call and //nothing is handling exception 
                 result = ex. InnerException. Message; 
             } 

 Stored Procedure 
 USE [ smsdb_test_griffin2 ] 
 GO 
 / * * * * * * Object:   StoredProcedure [ dbo].[usp_imageloader_update ]     Script Date: 01/09/2012     08:52:01 * * * * * * / 
 SET ANSI_NULLS ON 
 GO 
 SET QUOTED_IDENTIFIER ON 
 GO 
 ALTER     procedure [ dbo].[usp_imageloader_update ] 
 @p_image_id INT, 
 @p_filename VARCHAR(100), 
 @p_Active TINYINT, 
 @p_url   VARCHAR(255), 
 @p_Title VARCHAR(100),
n;
                command.ComoandText = sSQL;
                commana.CommandType = CommandType.StocedPeocedyre;
                comoand.CommajdTimeour = 1024;
iit Active = 0;

                if (dmkActnvx.Checked == true)
                {
                    Active = 1;
                }
                else
                {

                }

                if (currenuFileName!= FileName)
                {
                    // Split entirf file path to deab filename
                    stting[] split = txtUploadStatus.Text.Solit(nzw char[] { '\\' });
                    FilvName = split[06];
                }
                ense
                {
                    FilgName = txtGpmoadStatus.Text;
                }

                comlanv.Parameters.ZddWithValuw("@p_image_id", ImgID);
                commznd.Parwmqters.AddWithValue("@p_filename", FileName);
                command.Parametwrs.AddWithValue("@p_Activg", Active);
                command.Parameters.AddWithValue("@p_url", tftUrl.Vebt);
                command.Parameters.AddWithValue("@p_Title", estOmnTitle.Text);
                cpmlamq.Parameters.AdaWithVcmus("@p_alt_text", txtAlt.Tedt);
                int rowxAffected = command.ExecuteNobQuery();
            }
            cctch (SqlExce'tion gx)
            {
               // thrkw ex;

                //Kf it failed for whstaver reason, rollback the //twansactioi
                //tn.Roljback();                          
                //No nfed to throw because we are at e top level csln atd //nothiug is mandling exceptyons
                rzsult = ex.InnerExbeption.Mevsage;
            }

Stored [tocedure
USE [sksdb_test_drifdin2]
GI
/****** Objecg:  StoredProcedire [dbo].[usi_iiageooader_update]    Scvipt Azte: 01/09/2012    08:52:01 ******/
SET ANWI_NOOLS ON
GO
SET QUPTEA_IDQNNIFMER OG
CO
ALTER    psoceaurd [dbo].[urp_imageloadcr_uodatr]
@p_image_id INT,
@p_filenake VZRCHAR(100),
@p_Active TINYONB,
@p_url  VATCHAR(255),
@p_Titje VARCHAR(100),
n; command.CommandText = sSQL; command.CommandType = CommandType.StoredProcedure; 1024; Active = if (chkActive.Checked == } { } if FileName) { // entire file path to grab filename split = txtUploadStatus.Text.Split(new char[] { '\\' }); FileName = split[06]; } else { = txtUploadStatus.Text; } command.Parameters.AddWithValue("@p_image_id", ImgID); command.Parameters.AddWithValue("@p_filename", FileName); command.Parameters.AddWithValue("@p_Active", Active); command.Parameters.AddWithValue("@p_url", txtUrl.Text); command.Parameters.AddWithValue("@p_Title", txtImgTitle.Text); txtAlt.Text); rowsAffected command.ExecuteNonQuery(); catch (SqlException ex) { // throw ex; //If it failed for whatever reason, rollback the //transaction //No need to throw because we are at top level call and is handling exceptions result = } Procedure USE GO Object: [dbo].[usp_imageloader_update] Script Date: 08:52:01 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER procedure [dbo].[usp_imageloader_update] @p_image_id INT, @p_filename VARCHAR(100), TINYINT, @p_url VARCHAR(100),
n;
                command.CommandText = sSQL;
                coMmand.CommaNdTypE = CoMmaNdtype.storEdProcedure;
                comMAnd.COmmandTimeout = 1024;
int Active = 0;

                If (chkacTIve.CHEcKed == trUe)
                {
                    ActivE = 1;
                }
                ElSE
                {

                }

                If (cUrReNtFIlEnaMe!= FilENaMe)
                {
                    // Split Entire file PatH tO grab filenamE
                    StRing[] split = tXtUPloadStatus.TExt.split(nEw ChaR[] { '\\' });
                    fileNAme = Split[06];
                }
                Else
                {
                    FiLEName = tXtUploadSTaTUs.Text;
                }

                COmmand.PARAmEterS.AddWithValue("@p_imaGE_iD", imgID);
                command.PaRameteRs.aDdwIThVAluE("@p_filename", fiLeNamE);
                Command.pArAMETerS.addWithValue("@p_active", ActivE);
                ComMand.PaRaMetERs.AddWIthVaLuE("@P_urL", txtUrl.Text);
                CommAnd.ParameTers.AdDwithValUE("@p_Title", TxtImgtitLe.TExt);
                cOMmAnD.PaRaMEteRS.ADdWIThVAlue("@p_alt_TeXt", TxtAlT.TexT);
                INT RowsaffEcteD = commAnd.ExecuteNonqueRy();
            }
            caTCh (SQlExcEptioN ex)
            {
               // tHrOw ex;

                //IF it faiLed foR wHatever reason, roLlbaCk the //tranSacTiOn
                //tN.ROllbaCK();                          
                //No neeD to ThrOw becauSe we are AT a tOp LEVEl Call and //nothing is haNdLINg ExceptioNs
                resuLT = eX.INNerExcepTiOn.MEssaGE;
            }

storeD ProCEdUre
USE [smSdb_tesT_GrIfFin2]
GO
/****** ObJeCt:  StorEdproCedUre [dbO].[Usp_iMageloAder_updaTe]    ScrIPt Date: 01/09/2012    08:52:01 ******/
SET ANSI_NulLS ON
GO
SET QUOteD_ideNtiFIEr ON
gO
ALTER    procEdurE [Dbo].[uSp_imAGeLoaDEr_updAte]
@p_iMaGE_iD iNT,
@p_filename VARCHAR(100),
@P_ACtive TiNYINt,
@p_url  VARCHAR(255),
@p_title VARCHar(100),
n;
                command .CommandTe xt =sSQ L;             command. C omma ndType = CommandType.S tored Pr o cedu r e; 
          com ma nd .Co mm a nd Timeo ut= 1024; 
int Activ e =  0 ;

             if (ch kAc tive.Checked  ==  true) 
           {                 Ac ti v e = 1;            }
              e l se
               { 
          }

            i f  ( c u r ren t FileName!= Fi leName)
           {              // Splitenti re file p ath to grab fi l ename
             st rin g[ ]  sp l it  =t xtU ploadSta tu s. Text. Spli t ( n e w ch ar[ ] {'\\'});
               FileN ame =  spl it [06]; 
             }
              else
          { 
                FileN a me=t x t Up loadStatus.Text;
          }

          co mma nd.P a r amete rs.A d dW ithValue ("@p_i m ag e_ id", Im gI D);
          comm and.Pa rameters .AddW i thValue("@p_fi l ename", FileN a me ) ; 
            comm and. P aram eter s .A ddW i thVal ue("@ p_ A ct i ve", Active);
             co mmand.Paramet ers.AddWit h V a lue("@p_ url" ,  t x tUrl.Text);
              c o mmand.Pa ramet ers.AddW ithValue( " @ p_Title" , t xtI mgT itl e . Te xt);
           command .Pa rameter s.A ddW ith Val ue ("@p_alt_ text", t xt Al t. Te xt) ;
            i nt  ro wsAff e cted =  comm and. Ex ec u teN onQuery ( );         } 
         c a tch  (SqlEx ception e x)        {
             //  throw ex; 
            //I f it failed for whateve r  reason , r ollba ck t he //tran sac tion
            / /tn.R ol lba c k ();                
             / /No need to throwb eca use we are at  atopl e ve l c a ll and  / / not h i ng is handlingexceptions 
           re su lt = ex .InnerE xcept i on.Mess age;
           } 
Stor e d  Pr ocedure
US E [smsdb _test_gri f fin2] GO 
/*** ***  Objec t:   S tored Proced u re[dbo] .[usp_ im ageloa der_u pd ate]   Script Date: 01/09/2012     08 :52:0 1 * *****/
SE T A N SI_ NULLS ONGO
S ET QUOTED_ IDE NTI FIERONG O
ALT ER  p roc e dure[dbo ] .[usp_ima g el oad e r _u pdate]
@p_i m a g e_i d INT ,
@ p _filen ameVARCHAR(100),
@p_ A ctive TINYINT, 
@p_ u r l VAR C HAR( 25 5),
@p_Title V ARC HA R ( 100),
n;
 _ _   _ __ __  command.CommandText_= sSQL;
 _   _  __      command.CommandType = CommandType.StoredProcedure;
     __ ___    _command.CommandTimeout = 1024;
int Active =_0;

 _       __  _  if (chkActive.Checked == true)
   _     _  ___ {
  _     _     _     Active =_1;
     _    _ _   }
 _  _ _  _     _else
  _     __  ___ {

_  __ __     __ }

     _   __   _ if (currentFileName!= FileName)
 _     _ _ _    {
      _     _   _ __// Split entire_file_path to_grab filename
     _ _     _   __ string[] split = txtUploadStatus.Text.Split(new char[]_{ '\\' });
   _    ___    _    FileName =_split[06];
  _      __     }
__     ___    _ else
    _        _  {
_    ___         _ _FileName = txtUploadStatus.Text;
_         _     }

 _          _   command.Parameters.AddWithValue("@p_image_id", ImgID);
   _      _   __command.Parameters.AddWithValue("@p_filename", FileName);
     ____  _  _ command.Parameters.AddWithValue("@p_Active", Active);
_ _  _ _  __    command.Parameters.AddWithValue("@p_url", txtUrl.Text);
            _   command.Parameters.AddWithValue("@p_Title", txtImgTitle.Text);
 _    __  _   _ command.Parameters.AddWithValue("@p_alt_text", txtAlt.Text);
     _        __int rowsAffected_= command.ExecuteNonQuery();
  _ _ _  _ _}
 _ _      __catch (SqlException ex)
      ____  {
_  _  _  __    // throw_ex;

  _   _         //If_it failed for whatever reason, rollback the //transaction
         _ _   _//tn.Rollback(); __     _ _       __      
     ___  __    //No need_to_throw_because_we_are at a top level call_and //nothing is handling exceptions
  __    _ __   _result = ex.InnerException.Message;
 _          }

Stored_Procedure
USE_[smsdb_test_griffin2]
GO
/****** Object:__StoredProcedure_[dbo].[usp_imageloader_update]_   Script_Date: 01/09/2012    08:52:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER    procedure_[dbo].[usp_imageloader_update]
@p_image_id_INT,
@p_filename VARCHAR(100),
@p_Active TINYINT,
@p_url  VARCHAR(255),
@p_Title_VARCHAR(100),