SubSonic Forums
All Your Database Are Belong To Us

Simple Examples of Select, Insert, Update, and Delete

Latest post 05-04-2008 12:21 AM by yitzchok. 1 replies.
  • 05-03-2008 11:51 AM

    Simple Examples of Select, Insert, Update, and Delete

    Ok....total n00b here. Can someone give me some simple examples of how to use SubSonic once the DAL is created.

     Thanks!

  • 05-04-2008 12:21 AM In reply to

    Re: Simple Examples of Select, Insert, Update, and Delete

    SELECT * FROM Products
    ProductCollection pc = new ProductCollection().Load();

    Now Insert, Update, and Delete
    You can use the static members on the product class or you can use
    //Update
    Product p = new Product(1);//Loads the product with the PK number 1
    p.Name = "Product Name";
    p.Save();

    //Insert
    Product p = new Product();
    p.Name = "Product Name";
    p.Save();

    If I am I because I am I, and You are You because You are You, then I am I, and you are you. But If I am I because You are You, and You are You because I am I, then I am not I and You are not You. -Rabbi of Kotzk

Page 1 of 1 (2 items) | RSS