Using DataAdapter to execute query without returning result (not using Fill method)

337 Views Asked by At

I am using the following code to write XMLA query and execute it against a PowerBI instance:

var connectionString = $"Provider = MSOLAP;Data Source ={endpoint};User ID={username};Password={password};Persist Security Info=True;Impersonation Level=Impersonate;";

using (var connection = new AdomdConnection(connectionString))
{
    try
    {
        connection.Open();

        var query = "{\"refresh\" : {  " +
            " \"type\" : \"full\"," +
            "\"objects\" : [" +
            " {" +
            "\"database\": \"Personal\"," +
            "\"table\" : \"PersonalTable\"" +
            "}" +
            "]" +
            "}" +
            "} ";


        var currentDataAdapter = new AdomdDataAdapter(query, connection);
        var tabularResults = new DataTable();
        currentDataAdapter.Fill(tabularResults);
    }
    catch (Exception e)
    {

    }
}

point is that I don't need at all to fill a DataTable. I can only find constructions using the fill method to execute a query on the target but in my case I don't care about what's being returned. Is there another way to just execute it without using Fill ?

0

There are 0 best solutions below