Copied to clipboard

Flag this post as spam?

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


  • Robin 37 posts 109 karma points
    May 04, 2013 @ 15:11
    Robin
    0

    Recommanded API to connect to database???

    Hello

    I am creating .NET user controls and need a database connection. Till now I used the .NET way of connection to a database (example:

    Sql(Ce)Connection myConn = new Sql(Ce)Connection(umbraco.BusinessLogic.Application.SqlHelper.ConnectionString); 

    )

    If someone uses a different database then my user control is useless. I almost can't believe there is no api who checks on wich type of database Umbraco is installed and we can use that to open/close the connection (How are packages developped who uses a database?) but I can't find.

    Which is the correct way to connect to the database and automatically use the database where Umbraco is installed on?

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    May 06, 2013 @ 10:39
    Dave Woestenborghs
    0

    You can use the SQL helper that comes with Umbraco.

    I think it's located in the namespace umbraco.DataLayer

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    May 06, 2013 @ 11:43
    David Brendel
    0

    If you're using Umbraco 6 than you can also use PetaPoco to connect to the database.

    It's very usefull if you want to get pocos from you're database query.

  • Robin 37 posts 109 karma points
    May 08, 2013 @ 09:29
    Robin
    0

    Thanks a lot for the replies! I'll give it a try next week, unfortunately I'm not able to do it this week anymore

Please Sign in or register to post replies

Write your reply to:

Draft