PowerBIGatewayInstaller has stopped working Windows Server 2012

This short post shows you one of the possible ways to fix the PowerBIGatewayInstaller has stopped working problem. When run PowerBIGatewayInstaller then you might hit the following problem.

To resolve this isn’t that hard. You need to make sure your Windows 2012 R2 updated to Build 9600.

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

SQL Server Merge

This post showing you how to do an incremental update between 2 database tables. This post is using the famous Northwind database for SQL Server. I have a source table named Products1 as below.

To prepare for this demo. First, I have a table named Products2 with exactly the same structure as Products1. I then clear all the data in Products2.


Insert all the rows from Products1 table to Products2 table. After this the data will be exactly the same.

INSERT INTO Products2 SELECT * FROM Products1

Update one record in Products1 table and insert a row into Products1 table.

UPDATE Products1 SET CategoryID = 2 WHERE ProductName =‘WebForm’

INSERt INTO Products1 (ProductName, Discontinued) VALUES (‘WinForm’,0)

You can try the MERGE command below then you will see the data in Products2 table will be exactly the same as Products1 table.

MERGE [dbo].[Products2] T USING (select * from [dbo].[Products1] with(nolock)) S



    T.[ProductName] = S.[ProductName]

    ,T.[SupplierID] = S.[SupplierID]

    ,t.[CategoryID] = S.[CategoryID]

    ,T.[QuantityPerUnit] = S.[QuantityPerUnit]

    ,T.[UnitPrice] = S.[UnitPrice]

    ,T.[UnitsInStock] = S.[UnitsInStock]

    ,T.[UnitsOnOrder] = S.[UnitsOnOrder]

    ,T.[ReorderLevel] = S.[ReorderLevel]

    ,T.[Discontinued] = S.[Discontinued]

INSERT ([ProductID]










        VALUES(S.[ProductID]    ,










Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

CTO articles (Feb 2020)

The following articles are the good read for CTO. I put them in Sway as well as the links below.


Present Your Data Like a Pro


Are you ready to be a CTO?


In-House Development vs. Software Development Outsourcing: A Comparison of Pros and Cons


Posted in .Net, Cloud, Community, Computers and Internet, CTO, Data Platform | Tagged , , | Leave a comment

Microsoft Graph get users

This post get you the complete code for getting the user from Microsoft Graph. You will find a link https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http, Get a user. In order to achieve this, you need another link. The following code combine the code from the 2 links and print out the user display name.

The clientId is the id you need to get from your Azure Active directory, App registration.

public static async Task Run()



    string clientId = 00000000-0000-0000-00000000000000000″;

    var scopes = new List<string>() { “User.ReadBasic.All” }.ToArray();

    IPublicClientApplication clientApplication = InteractiveAuthenticationProvider.CreateClientApplication(clientId);

    InteractiveAuthenticationProvider authProvider = new InteractiveAuthenticationProvider(clientApplication, scopes);


    GraphServiceClient graphClient = new GraphServiceClient(authProvider);

    var users = await graphClient.Users


    .Select(e => new








    foreach (var user in users)






Reference: https://chanmingman.wordpress.com/2019/06/21/microsoft-graph-learning/

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform, Office 365 | Tagged , | Leave a comment

The operation could not be performed because OLE DB provider “SQLNCLI11” for linked server was unable to begin a distributed transaction

The post shows you one of the possible settings to resolve the error “The operation could not be performed because OLE DB provider “SQLNCLI11″ for linked server was unable to begin a distributed transaction” when you executing something like :

insert into [table1] EXEC [172.1111.1111.111].[n4dw].[dbo].[USP_Table1]

Go to the Properties the linked server. Set the Enable Promotion of Distribution Transaction to False.

Reference: https://stackoverflow.com/questions/24014718/the-operation-could-not-be-performed-because-ole-db-provider-sqlncli11-for-lin

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment

Blazor with static data

This article showing you how to add the array data into the Blazor page. I will create a

1. POCO class.

2. a Service class to insert the data.

3. add Service class to Startup.cs,

4. add Blazor Component to display the data.

5. add link to NavMenu.razor.

Create a class inaide Data folder


public class PersonModel


    public string FirstName { get; set; }

    public string LastName { get; set; }

    public string AccountBalance { get; set; }

    public string FullName => $”{FirstName} {LastName};


Create a service class name PeopleService in Data folder to populate data.

public class PeopleService


    public Task<PersonModel[]> GetPeopleAsync(DateTime startDate)


        PersonModel[] personModels = { new PersonModel() { FirstName = “John”, LastName = “Yu”, AccountBalance = “50” },

                new PersonModel() { FirstName = “Ming”, LastName = “Man”, AccountBalance = “50” }} ;

        Task<PersonModel[]> task = Task.FromResult(personModels);

        return task;



Add PeopleService to Startup.cs.

public void ConfigureServices(IServiceCollection services)







Add a Blazor Component to your project under the Pages folder.

Here I create a Blazor component named People.razor. The code as below.


@using BlazorApp1.Data

@inject PeopleService PeopleService


@if (forecasts == null)






    <table class=”table”>



            <th>First Name</th>

            <th>Last Name (C)</th>

            <th>Balance (F)</th>

            <th>Full Name</th>




        @foreach (var forecast in forecasts)












Add link into NavMenu.razor under the Shared folder.

<li class=”nav-item px-3″>

    <NavLink class=”nav-link” href=”People”>

        <span class=”oi oi-list-rich” ria-hidden=”true”></span> People



You go to People link then you will get the data below.

You can download the code here https://github.com/chanmmn/BlazorApp.

To do more you can refer to https://www.blogofpi.com/crud-using-blazor-and-entity-framework-core/.

Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged , | Leave a comment


This post showing how to use ADO.NET to retrieve data in .NET Core. This has nothing new, it works back then since Visual Studio.NET 2002. Somehow it is it is new in .NET Core and people can still provide the error code like this one https://www.yogihosting.com/ado-net-aspnet-core/. In the code below it is taking the product name from the famous Northwind database, you can download it here https://chanmingman.wordpress.com/2012/03/18/northwind-in-microsoft-sql-server-2012/.

Prerequisite: Visual Studio 2017 with .NET Core 2.2 and above. SQL Server Express, C#

First, create a .NET Core project. You need to add System.Data.Sqlclient 4.8.0 from nuget.

Create a console program. Add the following method to the program.

public static void GetProductName()


    //connection string

    string strConn = “Server=.;Database=Northwind;Trusted_Connection=True;”;

    SqlConnection conn = new SqlConnection(strConn);

    string sql = “Select * From Products”;

    SqlCommand command = new SqlCommand(sql, conn);

    //connect to sql server


    //retrieve sql data

    SqlDataReader dr = command.ExecuteReader();

    while (dr.Read())


        Console.WriteLine(“{0}”, dr[1].ToString());




Posted in .Net, Cloud, Community, Computers and Internet, Data Platform | Tagged | Leave a comment