Search code examples
c#sharepointsharepoint-2010web-parts

Sharepoint connect to another SQL server?


Here is the task I'm checking: 1) have a product database, which is managed by another application (it has no relation with sharepoint). 2) now, my boss want to have an application within the sharepoint portal to search this database, plus, audit the searches, i.e. who searched what at what time....

There is no problem if this is a regular asp.net application. But, what's the best way to do this in sharepoint?

My plan is to: use team site template (or blank template), create a webpart. then have UI, and gridview to show the result.

is this the way to do? I try to find an example of using gridview in webpart, but cannot find it. Is there any limitation of using asp.net control in webpart? what about use ajax toolbox control in webpart? any example?

thanks


Solution

  • Roughly there are 2 approaches you could go for:

    1. The webpart approach, just as your describe it. You can use an ASP.NET gridview with no problems in your webpart. As such, a webpart is nothing more (simplified...) than a user control with some dress up.
    2. Go for BDC/BCS. This will allow you to consume the external database and show the information as be it 'native' SharePoint data. This has the added benefit that the content can be made searchable from within SharePoint. Using this approach you also do not have to create a UI to present the data, as SharePoint will present it using the out of the box view pages, etc.

    The downside of the webpart approach (option 1) is that if you have multiple front end servers in your farm you need to handle the session in a way (e.g. by setting up sticky sessions on your loadbalancer, or by sharing your session somewhere centrally (in a db for instance)), as you don't want users to switch between servers in one session while they are using your webpart probably.

    The downside of option 2 is that at first it might seem complex, but let that not scare you away :-)

    http://msdn.microsoft.com/en-us/magazine/ee819133.aspx