Category Archives: Uncategorized

Getting the Named Pipes Provider Error 40? Here is an Easy Tip.

Today, I put together a simple reporting application that grabs data from the company’s central database. When I built the application, I got the Named Pipes Provider Error 40. It is a very long winded error that basically says it can’t connect to the local database. Turns out  that the work “local” was key.

Since, I was trying to connect to a remote database, I assumed it was a connection problem between my desktop and that server. I fired up SQL Server Management Studio to test the connection and it worked. So, I scratched my head and went Googling. Most of the results had to do with firewalls and TCP/IP protocols. More head scratching. After a little more Googling, I found a post on MSDN pointing out that LightSwitch needs to connect to the local instance of SQL Express even if you are using remote data (this is the MSDN thread: http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/ffd8830e-7147-4025-9229-8c9796466902).

A quick check of local SQL Express revealed that the service had been stopped. I started the service and the problem went away.

Here is the easy tip: Read the error message. If it says “local,” it probably means local 😉

Advertisements
Tagged , ,

Using a SharePoint Calendar with ComponentOne’s Scheduler for LightSwitch

This is a cross post… also posted on ComponentOne’s blog (“Using SharePoint Calendars with ComponentOne Scheduler for LightSwitch). To put it in context, Scheduler for LightSwitch is an extension that adds a calendar screen to a LightSwitch Project. You can download a trial over at ComponentOne.com if you are interested in kicking it around.

Microsoft Visual Studio LightSwitch has a great feature nobody talks about: the ability to use SharePoint as a data source. Data is created and stored in SharePoint all the time and that data is often useful in business applications. Imagine a project management or time management application, for example. Chances are that there is a SharePoint calendar somewhere that has useful data for that application.

ComponentOne Scheduler for LightSwitch extension gives you a snap-in Outlook scheduling application. All you need to do is add the screen to your project and select a data source. With this extension, you can add SharePoint calendar data to your LightSwitch application very easily.This article explains how you can use ComponentOne’s Scheduler for LightSwitch with a SharePoint calendar to create an Outlook-style scheduling application without code.

Setting up the Calendar Data Source

Scheduler for LightSwitch needs a table with seven fields to work properly. These fields are ID, Subject, StartTime, EndTime, Body, Location, and Properties. A standard SharePoint calendar has fields that can map to each, with the exception of Properties. You will need to create a Properties column.

Below are instructions to start from scratch. If you are using an existing calendar, make sure you first follow the instructions for creating a Properties column.

To create a new calendar, access SharePoint’s create list dialog, select Calendar, and name it.

Once the calendar is created, open the list setting page and click the Create Column link. Name the new column “Properties,” keep Single line of text selected and clear the Maximum number of characters field. There is often a large amount of data in the Properties field, so keeping the limit can cause errors.

Make sure you add at least one record to the list. A holiday is an easy example.

You now have a calendar that Scheduler for LightSwitch can use!

Creating the LightSwitch Application

Create a new LightSwitch project and select Attach to External Data Source from the start screen.  The Attach Data Source Wizard will open.

Select SharePoint and click Next.

Enter the URL to the site that hosts your calendar, select your login method, and click Next. Note that you just need the top level URL, not the path directly to the calendar. You will select that in the next screen.

Select the list (or lists) you would like to include, name it, and click Finish.

You should see a visual representation of the list in the LightSwitch designer.

Now, you can add the ComponentOne Scheduler screen. Click the Add Screen button, choose ComponentOne Calendar Screen, and select your list from the Screen Data drop-down.

When you click OK, you will see the design view for the Calendar screen you just created. The next major step is to map the screen data fields.

Click Holidays in the tree view and you will see Row Template properties appear in the Properties pane. Map the following:

  • Primary Key Property:  Id
  • Start Time Property: StartTime
  • End Time Property: EndTime
  • Subject Property: Title
  • Body Property: Description
  • Location Property: Location
  • Properties Property: Properties

You are now ready to run your new application.

Click the Start Debugging button or press F5.

You now have a basic scheduler application. This application will do the following:

  • Display items on the SharePoint calendar.
  • Allow you to export the entire calendar to iCal or XML.
  • Add events to the calendar one by one or import iCal or XML files. Anything entered will also appear in the SharePoint calendar.
  • Print a view.
  • Look at day, week, and timeline views.

More Features

Wait, there’s more!

By default, grouping is turned off. You can add a toolbar that allows users to group by resource, contact, or category. To turn the feature on, go to the screen designer, click on C1Scheduler, and check the Show Group Commands in the Properties pane.

Click the Start Debugging button.

You can also map more tables or lists to application.

To associate a separate data source (such as a contacts list), click Add Data Item to add the desired query to the screen. Add the collection to the end of the screen layout, then change the default control (DataGrid) to C1Contacts as shown in the following figure.

Note that the data item must exist and be part of the project. See the Adding Other Data Sources topic in the Scheduler for LightSwitch documentation for more details.

That’s All Folks

The combination of LightSwitch and ComponentOne Scheduler has made it very easy to create a scheduling application – even with SharePoint data. What are you using it for?

Tagged , , , ,