接上篇
1、插入数据
Customers custtomer = new Customers ();
custtomer.CustomerID="bccu";
custtomer.CompanyName="bccu";
custtomer.ContactName="bccu";
custtomer.ContactTitle="test";
custtomer.Address="159 hao";
custtomer.City="bj";
custtomer.Region="bc";
custtomer.PostalCode="dds";
custtomer.Phone="";
custtomer.Fax="";
custtomer.Country="china";
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
obj.Insert(custtomer);
注:CustomerID不是递增的,所以要在Customers实体类中设置
[KeyField("CustomerID",KeyType=UniqueIDType.OtherDefinition)]
2、更新数据
Customers custtomer = new Customers ();
custtomer.CustomerID="bccu1";
custtomer.CompanyName="bccu1";
custtomer.ContactName="bccu1";
custtomer.ContactTitle="test1";
custtomer.Address="159 hao1";
custtomer.City="bj";
custtomer.Region="bc";
custtomer.PostalCode="dds";
custtomer.Phone="";
custtomer.Fax="";
custtomer.Country="china";
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
obj.Update(custtomer,"CustomerID='bccu'");
3、删除数据
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
obj.Remove(typeof(Customers),"CustomerID='bccu1'");