Copied to clipboard

Flag this post as spam?

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


  • Sean 141 posts 179 karma points
    Jan 16, 2011 @ 02:34
    Sean
    0

    Newbie - connecting to umbraco database using umbraco's built in provider?

    Hi there, I'm new to umbraco ,  I wanted know how I can utilize the data providers to extend the cms. I'm needing to build a shopping cart and was wondering what the best approach would be.  Any source code would be much appreciated. Thanks in advance.

  • Richard Soeteman 4047 posts 12900 karma points MVP 2x
    Jan 16, 2011 @ 07:33
    Richard Soeteman
    0

    Hi,

    So you want to use a database to store order info? that could also be done using document types.This comes with the benefit to view them easy and directly in Umbraco  

    But if you have a lot of orders a database might be a better approach.Below you find a snippet how to work with Sql against the Umbraco database. I still use normal sql instead of Linq2Sql because in theory this would work on other databases such as Mysql as well. To run this snippet you need to add references to the dll's Umbraco, Cms, BusinessLogic, Interfaces, Umbraco.providers, Umbraco.Datalayer

     

     

    List<IParameter> parameters = new List<IParameter>();

    parameters.Add(

     

    Application.SqlHelper.CreateParameter("@UmbracoMediaId", mediaId));

     

     

    string sql = "DELETE FROM CMSImportMediaRelation WHERE UmbracoMediaId = @UmbracoMediaId ";

     

     

    Application.SqlHelper.ExecuteScalar<int>(sql, parameters.ToArray());

     

     Umbraco comes with a few commercial Ecommerce extensions that might be worth to checkout

    Cheers,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft