Connect to local SQL Server Tables,Stored Procedures & view, then show the result inside modern sharepoint pages

john john 1,026 Reputation points
2022-02-17T15:48:36.257+00:00

I am working on a migration from SharePoint 2010 to SharePoint Online. Where inside the on-premises the customer has a configurable Web Part (Server-side of course), which allow users to do the following:-

  • Specify a connection string to connect to SQL server on-premises.
  • Specify the Table or Stored Procedure or View to connect with.
  • optionally to pass a Parameter to the Database.

After that the web part will show the results from the database and allow the users to filter the data which will be shown in a tabular format.

Here is a screenshot of the web part setting:-
175501-webpart.png

Here is a screenshot of a result from one web part instance:-
175491-webpart.png

So can we build similar web part using SPFx? If the answer is Yes, then is there an available 3rd party SPFx web part we can benefit from? Finally , i am also open to other approaches to achieve our work other than build/using SPFx web part.

Thanks in advance for any help.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2022-02-18T05:41:01.69+00:00

    Hi @john john ,
    You can refer to the following document to create an authenticated API (I would use a .NET API project), making sure to use keep the connection strings in the project configuration (web.config/settings .json)
    https://flow.microsoft.com/en-us/blog/on-premise-apis/
    Deploy your API to Azure. Keep the connection string the same. Azure should resolve the connection string and route traffic through the gateway. Then create a web part that calls the authenticated API to query the data.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.