Copied to clipboard

Flag this post as spam?

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


  • john 4 posts 24 karma points
    Dec 29, 2011 @ 15:17
    john
    0

    How do I query a legacy database?

    I wasn't sure where to ask this, but I wanted to query a legacy database and display it within the CMS as one of the "normal" pages.  Can you tell me where to start on that?  I have never used Umbraco before but wanted to download and learn.  But, I have to be able to query other databases (lots of them) and display them within the cms like any other page.  Thanks for direction.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 29, 2011 @ 15:41
    Jan Skovgaard
    0

    Hi John

    You can configure database access in the web.config in the <appSettings> section and then fetch data and include it on pages with user control based macroes.

    You can configure the DB access like this: <add key="Nameofyoudb" value="server=.\SQLEXPRESS2005;database=AdventureWorksLT;user id=user;password=password" />

    Then write your user control and place the .dll file in the bin folder and place the user control in the user control folder.

    Log in to Umbraco and go to the developer section and under "macros" right click and select "create". When it's created you need to reference the "usercontrol" in the ".NET User Control" input field.

    When it's done, hit save and go to the "Settings" section and go to a template where you can place your macro by clicking the 4th button from the left called "insert macro".

    Hit save and go to a page that is using the template and you should be able to see the data there :)

    You can also see a more thourough guide on how to setup you project for creating user control base macroes for umbraco here: http://skiltzonnet.blogspot.com/2008/01/creating-you-first-umbraco-user-control.html

    Hope this helps.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft