Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access

QUICK FIX

http://blogs.technet.com/b/the_microsoft_access_support_team_blog/archive/2016/03/09/you-may-encounter-errors-with-your-accde-mde-files-and-or-wizards-after-installing-the-march-update-for-office-2010-kb3085515.aspx

 



I deployed a SharePoint feature that has an Event Receiver and ran into this error when trying to update the Today Column during a nightly batch run. The Error occured on random Document Libray items. So I did some research and found out that I needed to update the Event Receiver to run as Synchonous when Updating items. This solved the problem! By default Event Receivers run Asynchrounsly, which is not always ideal, especially in this situation.

To fix this problem just update the Element.xml file for the Event Receiver in question for the event type (Updating) you want to run as Synchronous as follows. Then redeploy. Be sure to Deactivate and Activate the site feature once it has been redeployed since it might not be used everywhere.

<Synchronization>Synchronous</Synchronization> under Elements -> Receivers -> Receiver tag

Also in my nightly batch job I used the following code to disable Events when Updating... The Using Code is further down the page.

//Disables Events when updating
using (var scope = new DisabledItemEventsScope())
{
SPList list = oWebsite.Lists["Code Rules"];
//This must be switched on, otherwise the Update method will throw an exception.
collWebsite[i].AllowUnsafeUpdates = true;

for (int k = list.Items.Count - 1; k >= 0; k--)
{
SPListItem item = list.Items[k];
//This only Works if the List Item was manually Updated before using a column called Today.
item.Properties["Today"] = DateTime.Now.Date.ToString(CultureInfo.InvariantCulture);

//SystemUpdate Updates without changing the Modified Time OR Modified By and DOES NOT make a New Version!
item.SystemUpdate(false);
}
collWebsite[i].AllowUnsafeUpdates = false;
}

        #region DisabledItemEventsScope
        /// <summary>
        /// Disabled item events scope
        /// </summary>
        /// <see cref="https://adrianhenke.wordpress.com/2010/01/29/disable-item-events-firing-during-item-update/"/>
        class DisabledItemEventsScope : SPItemEventReceiver, IDisposable
        {
            bool oldValue;

            public DisabledItemEventsScope()
            {
                this.oldValue = base.EventFiringEnabled;
                base.EventFiringEnabled = false;
            }

            #region IDisposable Members

            public void Dispose()
            {
                base.EventFiringEnabled = oldValue;
            }

            #endregion
        }
        #endregion DisabledItemEventsScope

Good Luck!



  1. Type in secpol.msc /s
  2. Select "Local Policies" in MSC snap in
  3. Select "User Rights Assignment"
  4. Right click on "Log on as batch job" and select Properties
  5. Click "Add User or Group", and include the relevant user.

 

I'm posting this as some idiot at a stupid company (you know who you are!!) changed a Global Group policy and it broke the permissions for the Service Account used to run Task Manager Jobs.

Good Luck!



1. Run regedit

2. Go to HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common (repeat for muliple versions of MS Office)

3. Create a KEY called "Security" here by right clicking on the Common key and selecting New->Key and typing "Security"

4. Create a DWORD in the Security key by right clicking on Security, selecting New->DWORD and type in "DisableHyperlinkWarning"

5. Change the value of this DWORD to 1



Someone created a VM for me recently and everyime I launched IE to get to our SharePoint site internally I was being prompted to login. So I changed the IE Setting to use my credentials to log in automatically. That was OK for the time I was on the VM. BUT, when I went back in it asked me again and my settings in IE had been reverted.

This was so annoying that I Googled it and found out that it was the IE Enhanced Security Configuration that was causing this problem. So I switched it off and not it doesn't prompt me any more :-)



You write some LINQ code to update your SQL tables like this below BUT it does not throw an exception and it does not Update the tables!

using (var db=new SomeDatabaseContext())
{
     db.SomeTable
       .Where(x=>ls.Contains(x.friendid))
       .ToList()
       .ForEach(a=>a.status=true);

     db.SubmitChanges();
}

The reason why is because your Table does not have a Primary Key! You can update your DBML designer to have that Primary Key and you don't need to touch the actual SQL Server tables for this to work!

Best of Luck.



WITH  q AS
        (
        SELECT TOP 1 *
        FROM    mytable
        /* You may want to add ORDER BY here */
        )
DELETE
FROM    q

Note that

DELETE TOP (1)
FROM   mytable

will also work, but, as stated in the documentation:

The rows referenced in the TOP expression used with INSERT, UPDATE, or DELETE are not arranged in any order.

Therefore, it's better to use WITH and an ORDER BY clause, which will let you specify more exactly which row you consider to be the first.



ALTER FUNCTION [dbo].[fnGetPipelineProductsCarried]
 (
  @GIS_PipelineMasterId INT,
  @EnglishOrFrench NVARCHAR(20) = 'English'
 )
RETURNS VARCHAR(1000)
AS 
 BEGIN
  DECLARE @ReturnEnglish VARCHAR(1000) = ''
  DECLARE @ReturnFrench VARCHAR(1000) = ''
  DECLARE @ProductCarriedName NVARCHAR(255) = ''
  DECLARE @ProductCarriedNameFrench  NVARCHAR(255) = ''
  DECLARE @TempTable TABLE (
          PipelineName NVARCHAR(255),
          ProductCarriedName NVARCHAR(255),
          ProductCarriedNameFrench NVARCHAR(255),
          SUBABC NVARCHAR(5),
          PercentH2S DECIMAL(18,3),
       GIS_ProductCarriedTypeId INT,
       GIS_PipelineMasterId INT,
       DummyID INT IDENTITY(1,1) NOT NULL
  )

  INSERT INTO @TempTable  
  SELECT DISTINCT
      pm.PipelineName,
      pct.ProductCarriedName,
      pct.ProductCarriedNameFrench,
      pspc.SUBABC,
      pspc.PercentH2S,
      pspc.GIS_ProductCarriedTypeId,
      ps.GIS_PipelineMasterId
    FROM ((GIS_PipelineSegment ps
   INNER JOIN GIS_PipelineSegmentProductCarried pspc ON ps.GIS_PipelineSegmentId = pspc.GIS_PipelineSegmentId)
   INNER JOIN GIS_PipelineMaster pm ON ps.GIS_PipelineMasterId = pm.GIS_PipelineMasterId)
   INNER JOIN GIS_ProductCarriedType pct ON pspc.GIS_ProductCarriedTypeId = pct.GIS_ProductCarriedTypeId
   WHERE pm.GIS_PipelineMasterId = @GIS_PipelineMasterId
   ORDER BY pm.PipelineName,
      pspc.SUBABC;

  --Counters
  DECLARE @count INT
  DECLARE @count_max INT
  
  SET @count = 1
  SELECT @count_max = COUNT(DummyID) FROM @TempTable

  WHILE(@count <= @count_max)
  BEGIN
   SELECT @ProductCarriedName = ProductCarriedName,
             @ProductCarriedNameFrench = ProductCarriedNameFrench
     FROM @TempTable
    WHERE DummyID = @count
  
   SET @ReturnEnglish = @ReturnEnglish + @ProductCarriedName + ', '
   SET @ReturnFrench =  @ReturnFrench  + @ProductCarriedNameFrench + ', '
   
   --Must Always be at the end of the Loop
   SET @count = @count + 1
  END
  
  IF @EnglishOrFrench = 'English'
  BEGIN
   SET @ReturnEnglish = CASE @ReturnEnglish
                        WHEN NULL THEN NULL
                        ELSE (CASE LEN(@ReturnEnglish)
                              WHEN 0 THEN @ReturnEnglish
                              ELSE LEFT(@ReturnEnglish, LEN(@ReturnEnglish) - 1)
                              END )
                        END
 
   RETURN @ReturnEnglish
  END
  ELSE
  BEGIN
   SET @ReturnFrench = CASE @ReturnFrench
                       WHEN NULL THEN NULL
                       ELSE (CASE LEN(@ReturnFrench)
                             WHEN 0 THEN @ReturnFrench
                             ELSE LEFT(@ReturnFrench, LEN(@ReturnFrench) - 1)
                             END )
                       END

   RETURN @ReturnFrench
  END   
  
  RETURN @ReturnEnglish  
   
 END



Error: TF400018: The local version table for the local workspace MY-PC;My User could not be opened. The workspace version table contains an unknown schema version.

Fix

Backup the folder first!

  • Click the box in "Workspace".
  • Click on "Workspaces".
  • Delete the workspace profile you're currently using
  • Re-connect to TFS open "Source Control"


  • So I just wasted 2 1/2 hours tring to figure out the WHY the Tab ordering was not working on my Form (C# project Visual Studio 2010).

    No matter what I did the order DID NOT CHANGE. There are all kinds of controls like Groupboxes, Panels with Controls inside Controls. No big deal. The View -> Tab Order feature made NO DIFFERENCE at all!!

    The only way the tab Order worked was by actually updating the DESIGNER to order the Controls in the way I wanted! Like this...

                this.pnlSubAbc.Controls.Add(this.lblProductA);
                this.pnlSubAbc.Controls.Add(this.cboProductA);           
                this.pnlSubAbc.Controls.Add(this.lblProductAH2S);
                this.pnlSubAbc.Controls.Add(this.txtProductAH2S);  
                this.pnlSubAbc.Controls.Add(this.lblProductB);
                this.pnlSubAbc.Controls.Add(this.cboProductB);        
                this.pnlSubAbc.Controls.Add(this.lblProductBH2S);
                this.pnlSubAbc.Controls.Add(this.txtProductBH2S);
                this.pnlSubAbc.Controls.Add(this.lblProductC);
                this.pnlSubAbc.Controls.Add(this.cboProductC);
                this.pnlSubAbc.Controls.Add(this.lblProductCH2S);
                this.pnlSubAbc.Controls.Add(this.txtProductCH2S);
                this.pnlSubAbc.Location = new System.Drawing.Point(3, 344);
                this.pnlSubAbc.Name = "pnlSubAbc";
                this.pnlSubAbc.Size = new System.Drawing.Size(562, 212);
                this.pnlSubAbc.TabIndex = 2;
                this.pnlSubAbc.TabStop = false;
                this.pnlSubAbc.Text = "Products Carried";

    Hope this Helps someone else out there.



    The Blogger

    Dave Stuart I'm a Developer with a passion for coding. I enjoy the challengers that come with the job! SharePoint is one of my expert areas along with .NET Web Development with MVC and good old MS Access VBA coding. I Blog so that I can remember how I did that way back when; PLUS all this stuff is searchable! I constantly study and run my own business, Dafran Inc. I have passed 22 Microsoft Exams since 1998 when I first jumped on the treadmill of knowledge. I hope that you enjoy this Blog as much as I enjoy updating it. All the very best from Calgary, Alberta, Canada. contact me at linkedin @ dafran.ca

    Calendar

    <<  November 2017  >>
    MoTuWeThFrSaSu
    303112345
    6789101112
    13141516171819
    20212223242526
    27282930123
    45678910

    View posts in large calendar

    Sign in