Пример #1
0
        public static bool UpdateError(int id, int UserID, string Desc)
        {
            bool   bRet = false;
            string sSQL = "";

            sSQL = "UPDATE dbo.ErrorTable SET Corrected = 1 WHERE ErrorID=@ID;";

            using (Data DC = new Data("conn", "Errors", "UpdateError"))
            {
                try
                {
                    //make an independent connection to the error database
                    DC.AddCommand(CommandType.Text, sSQL);
                    DC.AttachParameterByValue("@UserID", UserID);
                    DC.AttachParameterByValue("Desc", Desc);
                    DC.AttachParameterByValue("ID", id);

                    int iRet = DC.ExecuteCommand();

                    if (iRet > 0)
                    {
                        bRet = true;
                    }
                }
                catch
                {
                    bRet = false;
                }
                finally
                {
                    if (DC != null)
                    {
                        DC.Dispose();
                    }
                }
            }
            return(bRet);
        }