In SharePoint While you import the BDC (XML) file you may get this error:
"Could not create profile page for Entity 'xxx'.The error is: Cannot create a new connection to closed Web Part 'x-y-z' "
After 2 days searching with no practical solution I decide to solve it by myself by monitoring SQL and Web Parts underground, finally I've found and solved the solution.It worked to me 100%.
What is the error exactly?
While you create a specific finder for the BDC to profile it, (so "could not create profile..." warning solve by the way) then you may get the above error because one of the following reasons which I've found (you should do step by step in my order to get faster response):
Problem 1: You might close "Profile Page Template Web Part", when a BDC want to associate a profile to a template page it returns and error that : "Cannot create a new connection to closed Web Part".
1. Go to the "Shared Services" admin page.
2. Under "Business Data Catalog" click on "Edit profile page template".
3. If you don't see the "Business Data Item" Web Part in the page go to Step 4 , otherwise go to Problem 2 .
4. Navigate to Site Actions->Edit Page then click on "Add a Web Part", this will open a page.
5. On the opened "Add Web Part to Top Zone" page, click on "Advanced Web Part gallery and options".
6. On the "Add Web Parts", click on "Closed Web Part" and select "Business Data Item" and drag to the page to restore it.
7. click "Exit Edit Mode" (on top right).
8. You done.So back to the BDC import page and import the BDC.
Problem 2: Check Problem 1 first.Do not waste your time. If did so, your problem is you closed a web part in which may did not remove from SQL correctly.
1. I've coded a TSQL to solve faster and safe, so copy the uniqueidentifier for the close web part from the error message, for example mark and copy the bold section:
"The error is: Cannot create a new connection to closed Web Part g_38004421_f6ad_4880_807a_8c90bcf42f4a "
note that I do not mark and copy "g_".
2. open SQL management studio and query this script. Replace the bold parameters with yours:
DECLARE @Id nvarchar(50)
DECLARE @WId nvarchar(50)
SELECT @WId = 'UNIQUEIDENTIFIER '
SELECT @Id =(
SELECT id FROM AllDocs
WHERE id =(
SELECT tp_PageUrlID FROM WebParts
WHERE tp_id like '%' + @WId + '%' ))
DELETE FROM WebParts
WHERE tp_PageUrlID like '%' + @Id + '%'
DELETE FROM AllDocs
WHERE id like '%' + @Id + '%'
The code above find the UID that cause the error in the WebParts table and AllDocs related object, then delete them.
All works to me. Hope you too.