I have a compile error on example code to for "Adding a Record."
Here is my sample code from Default.cs for "Insert Button."
Code:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using V2.PaidTimeOffDAL;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnInsert_Click(object sender, EventArgs e)
{
//Create an instance of the data context
HRPaidTimeOffDataContext db = new HRPaidTimeOffDataContext();
//Create a new ENTUerAccount object and set the properties
ENTUserAccount userAccount = new ENTUserAccount
{
WindowsAccountName = @"VARALLO1\VaralloMadison",
FirstName = "Madison",
LastName = "Varallo",
Email = "[email protected]",
IsActive = true,
InsertDate = DateTime.Now,
InsertENTUserAccountId = 1,
UpdateDate = DateTime.Now,
UpdateENTUserAccountId = 1
};
//Signal the context to insert this record
db.ENTUserAccounts.InsertAllOnSubmit(userAccount);
//Save the changes to the database
db.SubmitChanges();
}
}
(The line receiving the error is in "red.")
Here is my error:
Error 1 The type arguments for method 'System.Data.Linq.Table<V2.PaidTimeOffDAL.ENTUserA ccount>.InsertAllOnSubmit<TSubEntity>(System.Colle ctions.Generic.IEnumerable<TSubEntity>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. C:\Users\Mick\Documents\Visual Studio 2008\Projects\PaidTimeOffSolution\PaidTimeOffUI\De fault.aspx.cs 40 8
http://localhost/PaidTimeOffUI/
If anyone can help it would be greatly appreciated.
Thanks
Mick