I have a project created with VS2010. I am running the project from VS2008. Plz note that, I am not running the solution. I am only running the project. Fortunately the solution has only one project.
And in the following line I am having an exception.
List<Order> OrderList = new List<Order> {
new Order
{OrderID = 10248,
CustomerID = "VINET",
EmployeeID = 5,
OrderDate = DateTime.Parse("7/4/2006", CultureInfo.CreateSpecificCulture("en-US")),
RequiredDate = DateTime.Parse("8/1/2006", CultureInfo.CreateSpecificCulture("en-US")),
ShippedDate = DateTime.Parse("7/16/2006", CultureInfo.CreateSpecificCulture("en-US")),
ShipVia = 3, Freight = 32.3800M, ShipName = "Vins et alcools Chevalier",
ShipCountry = "France",
Order_Details = new List<Order_Detail>(),
Customer = new Customer(),
Employee = new Employee(),
Shipper = new Shipper()}};
The exception is:
FormatException was unhandled:
String was not recognized as a valid DateTime.
Stack Trace is:
NwindObjectsCS.exe!NwindObjectsCS.frmMain.CreateOrderList() Line 142 C# NwindObjectsCS.exe!NwindObjectsCS.frmMain.btnInitializer_Click(object sender = {Text = "Load (&Initializer)"}, System.EventArgs e = {X = 86 Y = 22 Button = Left}) Line 51 + 0xe bytes C# [External Code] NwindObjectsCS.exe!NwindObjectsCS.Program.Main() Line 18 + 0x1d bytes C# [External Code]
What suppose to be the problem?
I have downloaded the code from WROX Web site. The code is from the book "Professional ADO.NET 3.5 with LINQ and the Entity Framework". Author is "Roger Jennings". So there should not be any problem.
It is from 3rd chapter.