Why is this thing not working?
[Database(Name="Relationships_Test")]
[Table(Name = "Order")]
public class Order
{
[Column(Name="ID", IsPrimaryKey=true)]
public int ID { get; set; }
[Column(Name = "OrderDate")]
public DateTime OrderDate { get; set; }
public void Save()
{
DataContext dc = new DataContext(@"Data Source=.\sqlexpress;Initial Catalog=Relationships_Test;Integrated Security=True");
dc.ExecuteCommand(@"INSERT INTO [Order] (ID,OrderDate) VALUES (@ID,@OrderDate)", this.ID, this.OrderDate);
}
}
Order o = new Order();
o.ID = 3;
o.OrderDate = DateTime.Parse("12/31/2999");
o.Save();
This code generates an exception
Must declare the scalar variable "@ID".