Copied to clipboard

Flag this post as spam?

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


  • Phil Dye 149 posts 325 karma points
    Jan 14, 2013 @ 12:56
    Phil Dye
    0

    Editing tables in external database

    I've got a need to provide simple table editing for a few tables in a different database from the Umbraco installation. Can Dewd handle this, ie a seperate connection string/DSN?

    Phil

     

  • Sune Bøegh 64 posts 374 karma points
    Jan 14, 2013 @ 13:04
    Sune Bøegh
    100

    Hi Phil,

    Sure thing. You can specify another connection string on both the container and repository elements in the config-file. So if you've grouped the tables/repositories in a container, you can add the connection-attribute with your custom DSN, like this:
    <dewd>   
      <container name="External database" connection="Server=myServerAddress;Database=myDataBase...">
        <repository name="Repo 1" />
        <repository name="Repo 2" />
        <repository name="Repo 3" />
      <container>
    </dewd>

    Hope that makes sense.

  • Sune Bøegh 64 posts 374 karma points
    Jan 14, 2013 @ 13:08
    Sune Bøegh
    0

    Btw. if you need to connect to a database, that isn't supported by Umbraco, you need to create a custom editor/view based on the Table*-classes, but it isn't difficult.

  • Phil Dye 149 posts 325 karma points
    Jan 14, 2013 @ 13:22
    Phil Dye
    0

    Sune - thanks, that works great!  I missed it in the docs, I should RTFM ;-)

    Phil

  • Sune Bøegh 64 posts 374 karma points
    Jan 14, 2013 @ 13:28
    Sune Bøegh
    0

    Haha, no prob.

    - Sune

  • eshan 12 posts 42 karma points
    Feb 01, 2013 @ 08:15
    eshan
    0

    Hi Sune,

    So for editor/view do i need to edit your source code?

  • Sune Bøegh 64 posts 374 karma points
    Feb 01, 2013 @ 08:27
    Sune Bøegh
    0

    Hi Eshan,

    No. To create a new editor/view/repository you can specifiy your own type on the tag in the xml-file, like this.
    <dewd>   
      <repository name="Languages" icon="mediaFile.gif">
        <view name="All" type="yourowntype,yourownassembly">
        </view>
        <editor tableName="umbracoLanguage" type="yourowntype,yourownassembly">
          <field title="ISO code" sourceField="languageISOCode" umbracoDataType="Textstring" />
          <field title="Culture name" sourceField="languageCultureName" umbracoDataType="Textstring" />
        </editor>
      </repository>
    </dewd>
    And then you can just inherit from one of the build-in types.

    Hope this makes sense.

     

     

  • Sune Bøegh 64 posts 374 karma points
    Feb 01, 2013 @ 08:28
    Sune Bøegh
    0

    Btw. you're welcome to start a new thread, if you have more specific questions regarding this.

  • eshan 12 posts 42 karma points
    Feb 01, 2013 @ 08:34
    eshan
    0

    sorry sune i didn't get what you say, will you please explain it more. below is the my xml code

    <container name="External database" connection="data source=Test;database=Test;user id=test;password=test">
          <repository name="Reviews">
              <primaryKey name="reviewID" />
    
              <view name="Reviews entries" pageSize="50" >
                  <columns>
                      <column field="DateAdded" title="Date Added" />
                      <column field="Rating" />
                      <column field="Title" />
                      <column field="Description" />
                      <column field="IsApproved" title="Is Approved"/>
                  </columns>
                  <sql>
                      <![CDATA[
                        SELECT reviewID, DateAdded, Rating, Title, Description, IsApproved
                        FROM tblReview
                      ]]>
                  </sql>
                  <editor tableName="tblReview">
                      <field title="ID" sourceField="reviewID" umbracoDataType="Textstring" readonly="true" />
                      <field title="Title" sourceField="Title" umbracoDataType="Textstring" />
                  </editor>
    
              </view>
          </repository
    

      </container> 

    All i need is to edit this record. :(

  • eshan 12 posts 42 karma points
    Feb 01, 2013 @ 09:31
    eshan
    0

    Btw what do you mean by yourowntype and yourownassembly. What are the built in types that I should inherit from?

  • Sudipta Nandi 8 posts 27 karma points
    Feb 11, 2015 @ 20:15
    Sudipta Nandi
    0

    how listControldatasouce will work for umbraco7.2.x

  • 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