Search code examples
c#sql-serverms-officeapps-for-office

Simple querying a database using apps for office?


I am trying to begin writing my first app for office.

What I would like to do is simple. I have a database of IDs for my customers. When I hover over one of these IDs, I'd like the app to query a database and display the customers info on the right hand side of the app.

This should be a pretty simple thing to do using apps for office, but I can find no guidelines or help on their web page.

Can anyone provide some simple sample code for doing this?

Thanks very much.


Solution

  • I can say that I spent some time going through this tutorial trying to get a solution for this question. I have a few suggestions about how you will need to proceed in writing your Office App.

    1. I would not advise having the data populate when you hover over an ID field in Excel/etc. You will be hitting your database too many times. I would have set it up, that the user with select a cell with the ID in it and then in your app panel, there will be a button click or event that will make a call to the SQL Server to return the data.

    2. You will need some sort of a web API that you can use to retrieve the data from your SQL Server. The event will pass in your ID that the user selects and then the web API will return the customer details to be populated in your app panel.

    Setting up the App Panel seems pretty straight forward in the tutorials on the MSDN site. You can set it up using HTML and CSS to design the page.

    I think the biggest thing that you will have to do is set up the API to access the data.