SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

Duking it Out with the BDC Object Model in a Webpart

I created a webpart that could create document libraries pulling in client names and ids from a sql server instance.  Unfortunately, it did not work in the production environment for some reason or another, so my colleague thought it might be  a good idea to use his BDC Instance.  I thought this was a good idea, but I am not very familiar with code related to the BDC.  I went to MSDN and Sezai's Blog to find some code.  I debugged the code a bit and added the proper references and import statements.  When I tested the webpart for some reason it did not work.  I am not 100% sure, but it's feeling as though the SSP is not opening properly.  I tried to get more information from the event log without luck.  If anyone wants to see what it looks like here is my code block(who knows maybe there is a tiny problem someone sees):

Dim SSPName As String

SSPName = "http://sspwebapp"

SqlSessionProvider.Instance().SetSharedResourceProviderToUse(SSPName)

Dim sysinstances As New NamedLobSystemInstanceDictionary

sysinstances = ApplicationRegistry.GetLobSystemInstances()

 

Dim NationalClientInstance As LobSystemInstance

NationalClientInstance = sysinstances("NationalClientsApp")

Dim NationalClients As Entity

NationalClients = NationalClientInstance.GetEntities()("NatClient")

Dim fc As New FilterCollection

fc = NationalClients.GetFinderFilters()

Dim NCEntityInstanceEnumerator As IEntityInstanceEnumerator

NCEntityInstanceEnumerator = NationalClients.FindFiltered(fc, NationalClientInstance)

 

While (NCEntityInstanceEnumerator.MoveNext())Dim row As DataRow

row = ClientTable.NewRow()

 

 

Dim IE As IEntityInstance

IE = NCEntityInstanceEnumerator.Current

row(
"ID") = IE("ID").ToString()row("Name") = IE("Name").ToString()

ClientTable.Rows.Add(row)

End While

 

I am pretty confident the part relating to the document library creation works as it worked in my VPC.  Also, if anyone has some good suggestions for other projects please let me know.  I love working with the Sharepoint Object Models and creating applications and webparts.


Posted 06-28-2007 12:22 PM by MOSSLover

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.