OWS sample code
Last Post 09/16/2009 6:35 AM by Paul Deschenes. 1 Replies.
Author Messages
daveg955
Nuke Master
Nuke Master
Posts:131


--
09/14/2009 2:13 AM
    <!--[if gte mso 9]> fficeDocumentSettings> fficeDocumentSettings> Normal 0 unctuationKerning/> false false false ontGrowAutofit/> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> <!--[if gte mso 10]> The OWS Part 1 Video 3 shows how to create a table using the SQL function in the DNN installation.  Because of the problems I was having, I watched this video several times to make sure I wasn’t missing something.

     

    The video gives the impression that I need to create a table using the SQL function in the DNN installation. 

     

    It also gives the impression that all I need to do is copy and paste the code from the sample text file and run it as a script in the SQL function.

     

    Following these instructions did not work.

     

    My first discovery was that the majority of the code in this text file is not SQL.  The SQL is wedged between other code. 

     

    I also discovered that before all of the SQL statements is “\n.”

     

    For example:

     

    \nSET ANSI_NULLS ON

    \nGO

    \nSET QUOTED_IDENTIFIER ON

     

    I’m also seeing “\n\t” scattered throughout the SQL but not necessarily before a statement.  I’m not an expert with SQL so I’m not sure if these are necessary.  I've attached the text file to show what I mean.

     

    Adding to my confusion is the discovery a separate tutorial of how to import this sample code through the Administration section of the module.

     

    Does importing the code somehow take care of creating the table at a later stage?  If not, where can I find syntactically correct SQL to create the table so I can continue with the tutorial?

     

    Paul Deschenes
    Nuke Active Member
    Nuke Active Member
    Posts:25


    --
    09/16/2009 6:35 AM
    Dave,

    Unfortunately, I don't see anything wrong with the attachment. The txt attachment is strictly for Importing into Open Web Studio, following the importing video instructions. This is to get the module configuration into Open Web Studio. After importing, there will be a comment in the list of actions which has the actual SQL to copy and paste to the DNN Host>SQL application or into your SQL Management Studio.

    AFTER importing this text file into Open Web Studio, you will then be able to use this configuration in an OWS module on a DNN page. So, after importing this configuration, in the OWS Administration page, under the Actions tab, you will see the first item is a Comment. It will be green.

    http://screencast.com/t/YcNPBezez

    You edit this comment, then copy and paste it to the SQL window to be run.

    Hope that helps.......

    Here is the actual SQL code that is contained in that comment action:

    /**** Change This Line To The Database For Your KB Application ****/
    USE [DNNCreative]
    GO
    /****** Object: Table [dbo].[KBArticle] Script Date: 03/25/2009 11:12:33 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[KBArticle](
    [KBArticleId] [int] IDENTITY(1,1) NOT NULL,
    [ArticleNumber] AS (case when len([KBArticleId])=(1) then 'KB-00000'+CONVERT([varchar](10),[KBArticleId],(0)) when len([KBArticleId])=(2) then 'KB-0000'+CONVERT([varchar](10),[KBArticleId],(0)) when len([KBArticleId])=(3) then 'KB-000'+CONVERT([varchar](10),[KBArticleId],(0)) when len([KBArticleId])=(4) then 'KB-00'+CONVERT([varchar](10),[KBArticleId],(0)) when len([KBArticleId])=(5) then 'KB-0'+CONVERT([varchar](10),[KBArticleId],(0)) else CONVERT([varchar](10),[KBArticleId],(0)) end),
    [Title] [varchar](150) NULL,
    [Summary] [varchar](max) NULL,
    [Symptoms] [varchar](max) NULL,
    [Resolution] [varchar](max) NULL,
    [Status] [varchar](max) NULL,
    [PublishDate] [datetime] NULL,
    [ArticleStatus] [varchar](20) NULL,
    [EditDate] [datetime] NULL,
    [CreateDate] [datetime] NULL,
    [EditUserId] [int] NULL,
    [CreateUserId] [int] NULL,
    CONSTRAINT [PK_KBArticle] PRIMARY KEY CLUSTERED
    (
    [KBArticleId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO
    SET ANSI_PADDING OFF
    Insert Into KBArticle(Title, Summary, Status, PublishDate, ArticleStatus,
    EditDate, CreateDate, EditUserId, CreateUserId)
    Values('My First Article','Hello World!','Fixed',getdate(), 'Published',
    getdate(), getdate(), 1,1)
    Paul Deschenes
    DNN Creative OWS Tutor
    Subscribe to the website


    ---