Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • k 255 posts 652 karma points
    Apr 22, 2019 @ 10:53
    k
    0

    SQL Query + umbraco

    Hello ,

    Is there a documentation on how to use sql query in umbraco ?

    Thanks,

    K

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 22, 2019 @ 11:43
    Alex Skrypnyk
    0

    Hi Kusum

    Umbraco uses PetaPOCO as mini ORM, so you can do a query super easy like that:

    long count = ApplicationContext.Current.DatabaseContext.Database.ExecuteScalar<long>("SELECT Count(*) FROM articles");
    

    Really nice articles about how to use PetaPOCO with Umbraco - https://www.wiliam.com.au/wiliam-blog/using-petapoco-with-umbraco-is-pretty-sweet

    https://anotherdevblog.com/2018/07/15/how-to-use-petapoco-with-umbraco/

    Thanks,

    Alex

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 09, 2019 @ 09:24
    Alex Skrypnyk
    0

    Hello Kusum

    Did you solve this issue?

    Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies