This series of articles is based on the following software environments:
Windows Server 2003 Enterprise Edition Service Pack 2
Microsoft Visual Studio Team System 2008
Microsoft SQL Server 2008
Microsoft Office Sharepoint Server 2007
Background
First, why do you want to synchronize SQL Server and SharePoint list data, which is an actual project application.
The customer's SharePoint site has four lists that form a hierarchy of organization data that ultimately comes from a table in a database that is used by another system. In the early stages of the project, developers manually export data from the database and then import it into a list that has already been created in the SharePoint site; later in the project, data in the source database changes, so developers need to manually check for changes in the data and synchronize to SharePoint List. Because of the large amount of data, this work is labor-intensive and energy-intensive, so we plan to write a stored procedure in SQL Server and add it to the scheduled task of SQL Server, so that SQL Server synchronizes the data automatically in a cycle. Because of the access to SharePoint sites and lists and the control of permissions, we thought of using CLR methods in SQL Server to write stored procedures and deploy them. The following is a screenshot of the structure and data sources of these four lists.
Area List
Two text-type fields, title and Area_code,title are the names of area, and Area_code is the region code for areas.
Region List
Title:text type, the name of the region.
Area:loopup type, pointing to the ID of the area.
Region_code:text type, Region encoding.