By , 14 Apr 2010

## Introduction

This article describes how to load and view iCalendars by using the DDay.iCal library. I will cover more advanced topics, such as creating, editing, and serializing iCalendars in my next article.

In this article, I will walk you through creating a console application that will load and display upcoming events to the user. I've also included an example project that demonstrates how to add this kind of support to an ASP.NET web application.

## Background

Many programmers have worked with adding some kind of calendar support to an application - from displaying upcoming events on a web site, to allowing personalized calendars, with the ability to alter them.

So, thousands of programmers, all adding calendar support to their applications. So, what's the problem with that? The historical answer is that no (or very few) programmers followed any kind of standard to implement their calendars. So, if you needed to accomplish anything else with the calendar that your original application didn't support, you'd have to write it by hand.

Also, these ad-hoc calendars are only viewable from the application that wrote them. What if you want to allow for recurrences in your calendar, so an event can recur "every 2nd-to-last Sunday of the month?" What if you want to publish your calendar, so others can subscribe to it, and view it from the calendar program they prefer? What if you want to display and manipulate calendars from multiple sources, including sources that you may not have control over?

These are some of the problems the iCalendar standard solves for us. If you didn't already know -- iCalendar is a W3C recommendation known as RFC 5545. You can find it here.

## Using the Code

To begin, open Visual Studio and create a "Windows Console Application" project. Then, if you haven't already done so, download the latest binary version of DDay.iCal from SourceForge.net. Once you've done that, you simply need to add a reference to DDay.iCal.dll from your project (i.e. click "Add Reference" from the "Project" menu).

Then, add the following to the top of the Program.cs file:

using DDay.iCal;

You're now ready to load your first iCalendar! There are multiple ways you can load iCalendars, ranging from simply loading the file from your local filesystem, to loading from a WebDAV or CalDAV store, to loading from a database. The possibilities are endless; however, in this article, we'll focus on simply loading the file from your local filesystem. Add the following code to your Main() method (of course, replacing the path with the actual path to your iCalendar file).

// Load the calendar file


Congratulations, you've loaded your iCalendar, and are ready to work with it! For now, let's display the events that occur today:

//
// Get all events that occur today.
//
IList&occurrence> occurrences = calendars.GetOccurrences

Console.WriteLine("Today's Events:");

// Iterate through each occurrence and display information about it
foreach (Occurrence occurrence in occurrences)
{
DateTime occurrenceTime = occurrence.Period.StartTime.Local;
IRecurringComponent rc = occurrence.Source as IRecurringComponent;
if (rc != null)
Console.WriteLine(rc.Summary + ": " + occurrenceTime.ToShortTimeString());
}

That's it! To be clear, calendars.GetOccurrences(...) returns a list of Occurrence objects. Occurrence objects describe each occurrence, including the date/time the occurrence happens, and a reference to the original component that generated the occurrence. We cast the Source of the occurrence to an IRecurringComponent, and display its properties.

So, now we've displayed all the events that occur today. Let's display all of the upcoming events that will occur within the next 7 days:

//
// Get all occurrences for the next 7 days, starting tomorrow.
//
occurrences = calendars.GetOccurrences

Console.WriteLine(Environment.NewLine + "Upcoming Events:");

foreach (Occurrence occurrence in occurrences)
{
DateTime occurrenceTime = occurrence.Period.StartTime.Local;
IRecurringComponent rc = occurrence.Source as IRecurringComponent;
if (rc != null)
Console.WriteLine(rc.Summary + ": " + occurrenceTime.ToString());
}

As you can see, this code is nearly identical to "Today's Events", with a slight difference at calendars.GetOccurrences(...). We also display the full date/time of the recurrence this time.

Note: If you're only interested in certain kinds of components (i.e. Events, Todos, etc.), then you can get occurrences for only those events using the generic version of GetOccurrences (i.e. calendars.GetOccurrences<IEvent>(...)).

## Final Code

Here's the final result of Program.cs:

using System;
using System.Collections.Generic;
using System.Text;

// Required DDay.iCal namespace
using DDay.iCal;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

//
// Get all events that occur today.
//
IList&occurrence> occurrences = calendars.GetOccurrences

Console.WriteLine("Today's Events:");

// Iterate through each occurrence and display information about it
foreach (Occurrence occurrence in occurrences)
{
DateTime occurrenceTime = occurrence.Period.StartTime.Local;
IRecurringComponent rc = occurrence.Source as IRecurringComponent;
if (rc != null)
Console.WriteLine(rc.Summary + ": " +
occurrenceTime.ToShortTimeString());
}

//
// Get all occurrences for the next 7 days, starting tomorrow.
//
occurrences = calendars.GetOccurrences

Console.WriteLine(Environment.NewLine + "Upcoming Events:");

foreach (Occurrence occurrence in occurrences)
{
DateTime occurrenceTime = occurrence.Period.StartTime.Local;
IRecurringComponent rc = occurrence.Source as IRecurringComponent;
if (rc != null)
Console.WriteLine(rc.Summary + ": " + occurrenceTime.ToString());
}
}
}
}

## Points of Interest

For more information, visit the DDay.iCal homepage at ddaysoftware.com.

Many apologies that it's taken so long to update this article. I'll now be providing more frequent updates.

## History

• 04/14/2010 - Updated to version 1.0 Alpha
• 03/09/2007 - Posted

Web Developer
United States
Doug has been a Software Engineer for 7 of the previous 9 years, and has 12 years of programming experience.

For the past 3 years, he has been developing custom applications in C# and Visual Basic.NET, with an emphasis on custom cross-Internet applications for IT management, real-time collaboration, and process management and reporting.

Votes of 3 or less require a comment

 Search this forum Profile popups    Spacing RelaxedCompactTight   Noise Very HighHighMediumLowVery Low   Layout Open AllThread ViewNo JavascriptPreview   Per page 102550
 Would be nice if article could be updated for version 0.80 manudurand 14-Mar-10 1:52
 Hi Doug, First of all, thanks a lot for this project, it's really useful. I intend to use your library to consume .ics calendars (published to web from Outlook 2007) and display the events on a Calendar control on an aspx page, all in C# code-behind. It would be nice if you could update this article (or create a new one) with the newest version on DDay.iCal (version 0.80). In particular, could you describe what is the Occurence object relative to the Event object? Which one should I loop through to get my list of events on each day (when my DayRenderEventHandler gets fired)? Thanks again, Emmanuel Sign In·View Thread·Permalink
 Funny you mention an updated article. I'm currently making some major changes to DDay.iCal and I'll update this article when that new version is released (likely to be version 0.90).   What you want to do is call Event.GetOccurrences(...) and use the list of Occurrence objects returned in your DayRenderEventHandler to show the different events.   Let me know if you have more questions.   Thanks, -Doug Sign In·View Thread·Permalink
 Hi Doug, Right now, I'm calling _Calendars.GetOccurrences(...) which returns me a list of Event Occurences. Then, for each day, I loop through each Occurrence object from the list. Which date should I compare with my DayRender date? occ.Period.StartTime.Local.Date or occ.Component.Start.Local.Date? Not quite sure what's the difference between these two... Thanks again, Emmanuel Sign In·View Thread·Permalink
 Use occ.Period.StartTime.Local.Date. This represents the current occurrence date/time, whereas occ.Component.Start.Local.Date represents the date/time of the original component. For example, if you schedule an event that starts on March 14th, 2010 at 8:00 AM, and recurs every week on the same day/time. evt.GetOccurrences(...) would return the following dates (contained in Occurrence.Period):   3/14/2010 8:00 AM 3/21/2010 8:00 AM 3/28/2010 8:00 AM 4/4/2010 8:00 AM etc.   You'll notice on each of these Occurrence objects, the 'Component' points back to the original event (March 14th, 2010 at 8:00, and recurs every week).   Hope that clears it up a bit.   Let me know if you have more questions.   Thanks, -Doug Sign In·View Thread·Permalink
 Got it now. Thanks for the explanation, it's very much appreciated. I'll keep an eye on the next version release (any expected date?). Emmanuel Sign In·View Thread·Permalink
 Glad it's working   I plan on releasing the new version within the next week, two at most. It's been an almost complete rewrite of the code base to allow for better parsing, serialization, and object-model simplicity.   Keep on eye on SourceForge for the release.   Regards, -Doug Sign In·View Thread·Permalink
 great article jael36 24-Nov-09 9:55
 thanks for this. I have been looking into something like this all day...   my big question is: can ics files support outlook tasks as well as outlook calendar appointments?   The reason i ask is that everyone is concerned about synchronizing with the outlook calendar, but not many about setting new tasks!   Also, can we limit this to a 1-way feed? From a custom web calendar to outlook but not the reverse? I suppose it would be a setting within the custom web calendar. Sign In·View Thread·Permalink
 Re: great article Douglas Day 29-Dec-09 10:01
 Yes, iCalendar support Events as well as Todo items.   As far as the 1-way feed, that would be a setting in Outlook, or in the web server that distributed the iCalendar.   And sorry about the late response, just saw this -Doug Sign In·View Thread·Permalink
 Thanks Member 4557583 5-Aug-09 3:23
 Hi Doug,   Thank you for such a wonderful post. It helped me a lot. Can you also give me an idea how to parse vcards.   Thanks Panna Sign In·View Thread·Permalink
 Re: Thanks Douglas Day 5-Aug-09 4:12
 Panna,   I'm glad you've found DDay.iCal useful - don't forget to use the most recent version (now 0.71) from SourceForge.net[^], if you haven't done so already.   As far as vcards go, I haven't really given it much thought. In theory, it's a very close format to iCalendar, so I could share some of the code base and create a library for it. I'll give some thought to it, and if I have the time and use for it, I'll put it together.   In the meantime, there are several articles on CodeProject about vcard. Just search for "vcard c#".   -Doug Sign In·View Thread·Permalink
 Event.OccursOn and events that span two UTC days but is only 2 hours long i.i. wiin 30-Apr-09 14:38
 I'm having difficulties getting the Event.OccursOn to work properly. I have an event that starts at the 17th at 4PM Mountain Standard Time and runs for 2 hours. This converts to 11PM UTC to 1AM UTC the next day. Event.OccursOn evals to true irregardless of which of the two days (the 17th or 18th) I pass in as a UTC date. So when iterating thru the dates (as in the console app), that same event is now listed for both days, but the date is displayed using "evt.Start.Local.ToShortTimeString()". This is very confusing because is shows a two hour event starting at 4PM the 17th and 4PM the 18th as well. It should only display for the 17th. I'm having to manually check each Start Date and End Date with my own logic to really tell if that event is for the 17th or the 18th. Or am I confused here? Sign In·View Thread·Permalink
 Unfortunately, if you're consuming someone else's iCalendar output, you cannot "fix" the accuracy of the calendar. When an event is recorded that it happened from 11:00 PM to 1:00 AM (regardless of the UTC designation), then it "occurred" on both days. This information is important to preserve, as it maintains the accuracy of the calendar.   So - you might need to use another method other than "OccursOn" to build your calendar.   Let me know if you have more questions, -Doug Sign In·View Thread·Permalink
 Attachment Problem Member 2239769 8-Dec-08 5:24
 I am having hard time attaching a Word 2007 document file to event object. Here is my code ... ... DDay.iCal.iCalendar iCal = new DDay.iCal.iCalendar(); DDay.iCal.Components.Event iCalEvent = iCal.Create(); Binary[] binAttachList = new Binary[1]; binAttachList[0] = new Binary(); binAttachList[0].AddParameter("X-FILENAME", activity.Attachment.DisplayName); binAttachList[0].AddParameter("VALUE", "BINARY"); binAttachList[0].SetEncoding(EncodingType.Base64); binAttachList[0].Data = Read(@“C:\Temp\MyFile.doc”); iCalEvent.Attach = binAttachList; ... ... private static byte[] Read(string fileName) { using (FileStream reader = new FileStream(fileName, FileMode.Open)) { byte[] binaryData = new byte[reader.Length]; reader.Read(binaryData, 0, (int)reader.Length); return binaryData; } } The file does get attached, but if I open it in Office Word again it doesn’t open. What am I doing wrong? Could you please help me solve this problem? Sign In·View Thread·Permalink
 Re: Attachment Problem Douglas Day 8-Dec-08 5:58
 This problem has been fixed in the development version of the code, and will be included in the next release.   Thanks, -Doug Sign In·View Thread·Permalink
 View by Month, Week, Day Tommy Johnston 6-Nov-08 6:10
 Thanks for this Article/Software package. It looks like it will help me accomplish a goal of getting Outlook Calendars viewable through our Intranet.   This example gives an option to show data for the current day, and for the next 7. I'd like to use the ASP.NET Calendar Object to give users an option to choose a date in the past/future to view. Idealy I'd like to have a Monthly view that would show Events for all 30-31 days, for any month in the future.   I'd like to emulate the Outlook interface as closely as possible. Can anybody point me in the right direction?   Thanks,   Tommy Sign In·View Thread·Permalink
 Error When Trying to Access Data in iCalendar File jdcurtis 20-Jun-08 10:58
 Hi, Thanks for creating a great icalendar class library. I have one quick question. I'm parsing iCalendar files and some VEVENTS have DESCRIPTION items and some don't. If I try and get the DESCRIPTION from a VEVENT that doesn't have a value defined I get the following error message:   Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at DDay_iCal_TEST.Program.Main(String[] args) in C:\...\Program.cs:line 57 Press any key to continue . . .   Here's line 57: strEventDescription = evt.Description.ToString();   Do you have any suggestions on how I can handle situations where some VEVENTS have items like DESCRIPTION and some don't?   Thanks. Sign In·View Thread·Permalink
 FrequencyOccurrence use ? Elcado 21-May-08 1:07
 Hi,   i'm trying to convert palm calendar into iCalendar equivalent (for a HotSync conduit), and i meet some difficulties in the use of FrequencyOccurrence for recurrent events, using a DaySpecifier object embedded in the ByDay property of a RecurrencePattern object. For example (record is my palm event object): RecurrencePattern recPattern = new RecurrencePattern(); recPattern.ByDay.Add(new DaySpecifier(record.StartTime.DayOfWeek, FrequencyOccurrence.First));    Here is my problem: it seems that FrequencyOccurrence enumeration doesn't contain a Fourth statement: public enum FrequencyOccurrence { None = -2147483648, ThirdToLast = -3, SecondToLast = -2, Last = -1, First = 1, Second = 2, Third = 3, }  which is neccessary if the day of the event appears five times in the month.   Thank you for you great work !! Sign In·View Thread·Permalink
 How to create a Todo with an Alarm? LAURENT JP 31-Jan-08 3:43
 When I create an alarm in an Todo, I get an exception in Serializer.   How to create an alarm with DateTime set ?   Thanks. Sign In·View Thread·Permalink
 Net Framework 1.1 Support? CarlosSV 17-Dec-07 6:19
 Re: Net Framework 1.1 Support? Douglas Day 14-Jan-08 10:01
 Sorry for the delay in answering. No, the lowest version of the framework supported is .NET 2.0. Also, the Compact Framework is not supported, though this may be a feature that could be added in the future. Sign In·View Thread·Permalink
 Any VB examples? Gracie Diaz 22-Oct-07 7:11
 Hi, thanks exactly what I have been looking for.   Just a question :   Here is some samples on save ical into sql database. but there is no one to load an ical whit data (string) stored in sql.   Do I have to create a temporaly ics file whit the serialised data in sql before load it ?   thanks again David. Sign In·View Thread·Permalink
 Re: Great job rakeshg321 21-Oct-07 18:42
 Douglas,   Can you kindly provide us some sample code to read the iCalText from the database. I can store my calendar with events using Serializer class in the database, as suggested by you in your previous message, but when I try to read it from the database using either "iCalendar.LoadFromStream" or "serializer.Deserialize" methods I get the following error antlr.MismatchedTokenException: expecting "CRLF", found ' '   serializer.Deserialize expects TextReader as parameter and I use the following to read string into textreader TextReader trMyCal = new StringReader(str_iCal);   iCalendar.LoadFromStream expects Stream object as parameter and I use the following to initialize my Stream object Stream myStreamCalText = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(str_iCal));   I suspect the new line characters are getting replaced with 2 empty spaces when being store in the database. I tried to replace " " string in my str_iCal with "\r\n" but that does not work either   I am storing serializer.SerializeToString() in nText field of SQL 2005 database.   Thanks for the good work. I appreciate your help   -Rakesh Sign In·View Thread·Permalink
 API Keith Farmer 27-Sep-07 22:06
 Great work -- I'm glad I didn't have to write this.   One suggestion, though: add GetRecurrences(start, end|timespan) & GetRecurrences(date) methods that perform the Evaluate and return an enumeration of the recurrences within that period in order (eg by ascending start datetime & descending duration). This would greatly reduce code in very common scenarios.     ----- Keith J. Farmer [MSFT:VC#/DLinq] Sign In·View Thread·Permalink
 Re: API Douglas Day 1-Oct-07 18:58
 Thanks!   That's a good idea - one that many people have noted. Methinks I'll add it to the next major release I actually like the GetRecurrences() methodology. Anyhow, thanks for the note.   Regards, -Doug Sign In·View Thread·Permalink
 Thanks and a Question ChristopherN 2-Aug-07 3:48
 This article and your code are both great! I am planning to use your library to schedule some jobs and I want to store the events in SQL Server. I have seen the thread were you showed someone how to serialze and store the calendar in a DB. My needs are different: I need to poll the calendar and find events that fit within a small timespan to kick-off jobs. The db will be polled on a timer and I am concerned about performance. I think that defining a db schema that mirrors the iCal schema and storing each scheduled event as a record (or several records if needed) will ease the querying of the data. The only time I would need to structure the data in ICS format is when a user wants to export their scheduled jobs to their personal calendar client. Do you think that creating a db schema based on your library/iCal/ICS is the right way to go? Sign In·View Thread·Permalink
 Re: Thanks and a Question Douglas Day 2-Aug-07 15:50
 Christopher,   Yes, I would use the ICS format for scheduled jobs, but I see no need to duplicate the ICS format in the database. Really, all you'd need to do is detect changes in your ICS file (via some sort of hash, or by using the iCalendar's LastModified property), and then re-evaluate your recurrences whenever the iCalendar changes.   From my perspective, all you'd need to do is store a list of Date/Times when the event recurs, the iCalendar where the event is stored, and the UID of the event, in a recurrence table in the database. Then, in another database table, you can store the actual iCalendar text. When querying the recurrence table, and finding an event that needs some action taken, you can then load the corresponding iCalendar and take action based on the event.   So, when the iCalendar file changes, you'd clear out the recurrences in your recurrence table in the database, and repopulate it via the iCalendar file. Of course, you'll only want to populate a given period in the future, and will periodically need to calculate future occurrences (once monthly, perhaps?)   Anyhow, that's what I'd do.   Let me know if you have more questions, or if you'd like me to clarify further.   Thanks, -Doug Sign In·View Thread·Permalink
 Re: Thanks and a Question [modified] ChristopherN 6-Aug-07 3:53
 RE: "all you'd need to do is store a list of Date/Times when the event recurs, the iCalendar where the event is stored, and the UID of the event, in a recurrence table in the database" Yes, that is the direction that I have been going in. Thanks!   On another note, is there any XML support in your library? I don't see anything. Part of what I am working on requires a web service where iCal data will be used by the web methods. I vaguely remember seeing an XSD somewhere for iCal but don't remeber if it was a standard or an individual's implementation. I could write a schema myself, but would prefer a standard and would like it to work easily with your library. Any thoughts?   Thanks, Chris   -- modified at 9:12 Tuesday 7th August, 2007 Sign In·View Thread·Permalink
 Re: Thanks and a Question Douglas Day 26-Aug-07 10:27
 Chris,   Sorry in the delay in answering.   There is currently no support for an XML format in DDay.iCal, however, I have been putting a significant amount of effort into abstracting the serialization mechanisms in DDay.iCal to support any type of format (namely, xCal). There has been enough demand for an xCal format to move this forward. The only problem is that I'm short on time these days. It may take several months to get the xCal format built into DDay.iCal. I'll try to get this done ASAP.   Thanks, -Doug Sign In·View Thread·Permalink
 Re: Thanks and a Question Douglas Day 1-Oct-07 19:04
 One option is to BASE64 encode the iCalendar, so it will be XML-compliant. Also, I've been working on the xCal standard for DDay.iCal, so I'm hoping it will be complete within the next month or so. Anyhow, it will be complete once it passes all of the unit tests.   Thanks, -Doug Sign In·View Thread·Permalink
 Re: Thanks and a Question kneckedeck 27-Mar-09 4:02
 Hi!   Seems that you've put the xml-compliance on hold. It's a pity, it would have been very useful and would also make your project more "complete".   Any news regarding this? Will you keep developing this project? Can we expect any updates in the near future?   And thanks for a very nice article and project! Good work! Sign In·View Thread·Permalink
 Re: Thanks and a Question Douglas Day 27-Mar-09 5:44
 Hi,   Yes, I've had so many other projects that are keeping my attention that I haven't had a chance to push forward the xCal serialization. This is still on the slate, as it would be useful in many scenarios. I am still working on the project, albeit slowly. The major direction of DDay.iCal currently is in development of iCalendar validation. See http://icalvalid.wikidot.com/[^].   If you have suggestions of directions to take the project, or feature requests, please use the SourceForge.net project page[^.   Thanks!! -Doug Sign In·View Thread·Permalink
 windows mobile Celine971 12-Jun-07 3:17
 Hello!   Very good!!!   Can I use Icalendar on windows mobile? or else, is there any ical's free version for windows mobile?   Thank you for your response   Céline Sign In·View Thread·Permalink
 Re: windows mobile Douglas Day 2-Aug-07 15:52
 Sorry about the wait - I've answered this question before in the SourceForge forums, but I thought I'd answer here also, to save people time.   No, DDay.iCal does not currently support the .NET Compact Framework. I've thought about supporting this in the future, but this does not fit into my plans for the near future.   Thanks, -Doug Sign In·View Thread·Permalink
 Yes, you sure can.   You can serialize the iCalendar to the output stream of your web page. All you'd need to do is make sure you set the mime type to "application/calendar", and it should behave properly.   Thanks, -Doug   (Sorry about the delay in answering) Sign In·View Thread·Permalink
 GoooooooooooooD Stiven Wang 21-Mar-07 22:11
 Re: GoooooooooooooD Douglas Day 22-Mar-07 5:00
 Thanks!   I'll be writing another article in the next several weeks that describes how to create/modify items. DDay.iCal is already capable of this, though. If you download the full DDay.iCal package from SourceForge, there are some examples of adding/modifying items to calendars.   If you have any other questions, please let me know.   -Doug Sign In·View Thread·Permalink
 Very nice Dan Letecky 13-Mar-07 3:30
 Very nice! You get my 5.   -- My sites for smart .NET developers: DayPilot - Open-source Outlook-like calendar control for ASP.NET DotLucene - The fastest open source fulltext search engine for .NET MenuPilot - Open-source task menu for ASP.NET 2.0 Seekafile Server - Flexible open-source search server DotNetFirebird Sign In·View Thread·Permalink
 Hi, firstly, gr8 article.   However, I would like to save the iCal information for every user of my app in a SQL 2000 database. Can you provide me with the basic information on how to go about it. Or have anyy links that have a tut. I've checked the project's website & wikipedia. Didnot find any tut on how to do this.   Thnx 4 the wonderful article. Sign In·View Thread·Permalink
 Thanks!   First of all, I'll try to get my next article out quickly, which talks about more advanced concepts like serialization and customization. I'm also working on some in-depth documentation and tutorials for my web site.   Anyway, that said, here's how I would do it:   First, include the DDay.iCal.Serialization namespace: using DDay.iCal.Serialization;Then, you can do something like the following: // Create a new iCalendar iCalendar iCal = new iCalendar();   // Add an event to the iCalendar Event evt = iCal.Create(); evt.Summary = "My event summary"; evt.Start = DateTime.Now;   // Create a serialization object iCalendarSerializer serializer = new iCalendarSerializer(iCal);   // Serialize the calendar into a string object string iCalendarString = serializer.SerializeToString();   SqlConnection connection = new SqlConnection("...connectionstring...");   // You'll want to customize this command to your database SqlCommand cmd = new SqlCommand(@" INSERT INTO myTable(Username, iCalendarString) VALUES (@uid, @str)", connection);   // Add our custom parameters to the query... // It's safer to build your SQL query this way, // so things like a single quote ' character // don't mess up your query. cmd.Parameters.Add("@uid", SqlDbType.VarChar); cmd.Parameters.Add("@str", SqlDbType.VarChar); cmd.Parameters["@uid"].Value = ...username...; cmd.Parameters["@str"].Value = iCalendarString;   try { connection.Open(); cmd.ExecuteNonQuery(); connection.Close(); } catch(Exception ex) { ... catch errors ... }Let me know if you have any more questions or problems,   -Doug Sign In·View Thread·Permalink