Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access
        SELECT TOP 1 *
        FROM    mytable
        /* You may want to add ORDER BY here */
FROM    q

Note that

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'
  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,

  INSERT INTO @TempTable  
    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,

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

  WHILE(@count <= @count_max)
   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
  IF @EnglishOrFrench = 'English'
   SET @ReturnEnglish = CASE @ReturnEnglish
                        WHEN NULL THEN NULL
                        ELSE (CASE LEN(@ReturnEnglish)
                              WHEN 0 THEN @ReturnEnglish
                              ELSE LEFT(@ReturnEnglish, LEN(@ReturnEnglish) - 1)
                              END )
   RETURN @ReturnEnglish
   SET @ReturnFrench = CASE @ReturnFrench
                       WHEN NULL THEN NULL
                       ELSE (CASE LEN(@ReturnFrench)
                             WHEN 0 THEN @ReturnFrench
                             ELSE LEFT(@ReturnFrench, LEN(@ReturnFrench) - 1)
                             END )

   RETURN @ReturnFrench
  RETURN @ReturnEnglish  

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.


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.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.

    Issue: You are performing an Sharepoint upgrade (via PSConfig.exe as mentioned here for example) but got the error Message "Cannot open SPTimerV4 service on computer '.'." as seen below:

    An error has occurred while validating the configuration settings.  
    An exception of type System.InvalidOperationException was thrown. 
    Additional exception information: Cannot open SPTimerV4 service on computer '.'.
    Solution: Make sure you are running the Powershell with "Run as Administrator" even if the account you are using has local Admin rights.

    One of our Clients were experiencing an issue while Opening one of the SharePoint 2010 Lists in Access. They were essentially Clicking on one of the links “Open in Access” from List’s Ribbon that would result in the following error.

    “Export to database failed. To export a list, you must have a Microsoft SharePoint Foundation-compatible application.” To resolve this Download and Install the below hotfix for 32-bit Office and then restart your computer.


    From here: https://dougieflash.wordpress.com/2013/03/08/updates-are-currently-disallowed-on-get-requests-to-allow-updates-on-a-get-set-the-allowunsafeupdates-property-on-spweb/

    If you are in Central Administration > Manage Web Applications and go to the General settings option,
    you might run into this error:

    · “Updates are currently disallowed on GET requests.

    · To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb.

    · Troubleshoot issues with Microsoft SharePoint Foundation.

    Correlation ID: e845bd26-f70b-4f65-a023-82ca9d126031”

    This error occurred in my dev environment. The behavior was that new applications would throw this error,

    “Updates are currently disallowed on GET requests” under the General Settings. The error stack trace mentioned

    ‘EnsureHttpThrottleSettings’ so it means that CA is trying to update these setting on a GET request for new apps
    that don’t already have them.

    Resolution via Powershell

    Launch Powershell and and add these lines:

    $w = get-spwebapplication http://yourwebapplication

    The call to the HttpThrottleSettings ensures they exist and Update() saves them.

    After completing these commands, you should be able to successfully launch the General Settings dialog window.

    From hiere: http://sadomovalex.blogspot.ca/2013/11/how-to-restore-site-collection-from.html?showComment=1443900554748#c8594024626886432758

    Sometimes you may face with situation that bug is only reproducibly on production, but not e.g. on QA or on your local development environment. Such problems are much harder to troubleshoot. Often they are caused by the content which exist only on production. And if troubleshooting directly on production is problematic (e.g. if you don’t have remote desktop access to it), you should get backup of site collection or whole content database, restore it on local dev env and try to reproduce bug here. But what to do if you have lower Sharepoint version on you local environment, than on production? Of course it is better to have the same versions, but world is not ideal and sometimes we may face with such situation. In this post I will show the trick of how to restore site collection from the higher Sharepoint version. Before to start I need to warn that this is actually a hack and you should not rely on it. There is no guarantee that it will work in your particular case, because new Sharepoint version may have different schema, incompatible with previous one (that’s why standard way is not allowed).

    Ok, suppose that we have site collection backup, which is created with Backup-SPSite cmdlet:

    Backup-SPSite http://example1.com -Path C:\Backup\example1.bak

    We copied it on local environment and want to restore it with Restore-SPSite:

    Restore-SPSite http://example2.com -Path C:\Backup\example1.bak –Confirm:$false

    (Here I intentionally used different urls for source and target sites in order to show that it is possible to restore site collection to the different url). If we have lower Sharepoint version on the local environment we will get unclear nativehr exception, which won’t say anything. But if we will make our logging verbose and check Sharepoint logs, we will find the following error:

    Could not deserialize site from C:\Backup\example1.bak. Microsoft.SharePoint.SPException: Schema version of backup 15.0.4505.1005 does not match current schema version 15.0.4420.1017.

    (Exact version number is not important. For this post it is only important that source version 15.0.4505.1005 is higher than target version 15.0.4420.1017).

    What to do in this case? Mount-SPContentDatabase also won’t work because of the same reason, i.e. content database backup also won’t work. In this case we can either update our environment (and you should consider this option as basic) or go by non-standard way.

    For non-standard way we will need hex editor. At first I thought that site collection backup is regular .cab file, so it will be possible to uncompress it, edit text files inside it and compress back (I described this trick in this post: Retain object identity during export and import of subsites in Sharepoint into different site collection hierarchy location), but this is not the case with site collection backups made with mentioned cmdlets. They look like regular binary files. So we will need some hex editor for modifying it. I used HxD hexeditor, but you can use any other as well.

    If we will open backup file in it and will try to find the version, which we got from error message from the log, we will find that it is located in the beginning of the file:

    The good thing is that version is stored only once. So we will change source version to the target in the hex editor now:

    Now save it and run Restore-SPSite again. This time restore should work. Hope that this trick will help someone. But remember that it is hack and use it carefully.

    From: http://blog.incworx.com/blog/consulting-from-the-trenches/disable-call-out-menu-in-sharepoint-2013-document-libraries

    We recently had a request from a customer that is in the process of upgrading from SharePoint 2007 to 2013 to change the way the edit menus look on items in lists and in document libraries. The desire was to return to the standard look used in SharePoint 2007 as they did not want the additional click when navigating to actions on an item.

    This is a fairly easy fix to implement on your lists and document libraries by modifying your existing views or creating new views on the lists or libraries that prefer this look and feel.

    The new call out menu looks like the example below



    The old style view from 2007 is in the following format




    In order to get the new menu strcture the easiest way will be to modify the existing view or create a new view for that document library or list.

    To do so perform the following steps:

    Go to your document library or list

    In the ribbon clock on Library and then either Modify View or Create view


    Once the view opens up you will scroll down to the bottom and you will see a section for Styles towards the bottom of the page on the left hand side. The current selection will be set to "Default"


    There are references out there that list to change this to "Newsletter, no lines", however I dont care for this view as it shows the items with alternating shading on each line which to me does not look very clean.

    Instead I utilize the "Basic Table" view as this shows the items just as it looks in a default SharePoint 2007 document library. So select "Basic Table" and then click OK to save the changes to the view.

    Once this is complete you will see that the menu drop down next to all documents in your library look like the old 2007 look and feel as is shown above.

    You can get rid of /_layouts/15/start.aspx in the URL by going to Site Actions -> Site Settings -> Manager Site Features -> Deactivate Minimal Download Strategy feature

    However this is a new framework in SharePoint 2013, which increases performance of SharePoint site..

    More reading here:

    What is /_layouts/15/start.aspx

    Why does /_layouts/15/start.aspx appear as part of SharePoint 2013 URL

    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


    <<  October 2021  >>

    View posts in large calendar

    Sign in