web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps with SQL ser...
Power Apps
Answered

PowerApps with SQL server connection - Offline

(0) ShareShare
ReportReport
Posted on by 10

Hello,

 

I am trying to use PowerApps offline mode for my SQL server database and I am having hard time to code it. My SQL server DB has two fields Name and ID. 
Can someone please help me on how to code it on PowerApps, for users  to be able to use it offline when entering in new data for my fields.

 

Thanks!

Categories:
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @SaimaRasheed,

     

    Have you checked the following documentation?

    Develop offline-capable apps with PowerApps

     

    Regards,

    Michael

  • SaimaRasheed Profile Picture
    10 on at

    Yes but I am getting a bunch of errors from using the code that is provided for Step3

    If(Connection.Connected,
    Collect('[dbo].[TestTable]', TestTable);
    UpdateContext({statusText: "Online data"})
    ,
    LoadData('[dbo].[TestTable]', "Name", true);
    LoadData('[dbo].[TestTable]', "GPID", true);
    UpdateContext({statusText: "Local data"})
    );
    LoadData(Test, "Name", true);
    LoadData(Test, "GPID", true);
    SaveData(Test, "Name");
    SaveData(Test, "Name");

    And I am not sure why 
    My local cache file that I created is called Test

    Thanks,
    Saima

  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @SaimaRasheed,

     

    Creating offline Apps for SQL Server data is not similar as the example article. There are many other aspects that we need to take into consideration.

    Please take a look at the posts from Staff CarlosFigueira in the following thread:

    Does the PowerApps solution has capaility for offline working

     

     

    For the code in step 3, I will try to explain it:

    If(Connection.Connected, // used to check connection status
    
     ClearCollect(LocalTweets, // Collect the Online Data when connection is online,collection name is LocalTweets
    Twitter.SearchTweet("PowerApps", {maxResults: 100})); UpdateContext({statusText: "Online data"}) //Context variable used to show Online Status , LoadData(LocalTweets, "Tweets", true); //When connection is offline, load Data from Local cache file named "Tweets" UpdateContext({statusText: "Local data"}) //Update the Status to offline ); LoadData(LocalTweetsToPost, "LocalTweets", true); //Load tweets that need to be posted from local cache file called "LocalTweets" SaveData(LocalTweets, "Tweets") //Save the LocalTweets collection into local cache file called "Tweets"

    To build an offline App that would work for SQL Server, basically we need to at least create 4 collections to work with it.

    1.  A collection to hold the online data,

    2. A collection for the newly added items,

    3. A collection for the updated items,

    4. A collection for the deleted items,

    Depends on the connection status, we need to either update the data source drectly, or update the local collection (then "sync" it with the Datasource when status is online).

     

    Regards,

    Michael

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard