Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to get a DNN URL from the Database so it can be used in SQLHow to get a DNN URL from the Database so it can be used in SQL
Previous
 
Next
New Post
3/16/2009 7:10 PM
 

Hi everyone,

I am trying to write a sql script to run against my database.

The issue i am having is that I need to insert a text/html module on to each Politicans profile.  Simple easy enough.

Then i need to insert an image, simple no problem

I need to make the image into a hyperlink with the URL pointing to the Politicians Rating Page. 

I have the string for the image and the URL but, the URL that points to the politicans rating page will have to change every iteration. Below is an example of the string for the image and hyperlink to the rating page.

<a href="http://r8yourpolitician.co.uk/Rate/Ratealexattwood/tabid/915/Default.aspx"><img height="105" width="229" src="/Portals/0/ratemeUK.png" alt=""/></a>

Can someone tell me how I can pull a URL for a page in the DNN database.

This url below is an example of the URL i need.

http://r8yourpolitician.co.uk/Rate/Ratealexattwood/tabid/915/Default.aspx

here is an example of the entry in the Tab table

915    49    0    Rate Alex  Attwood    0    182    1        0    Rate Alex  Attwood    Rate Alex  Attwood    Rate Alex  Attwood    0        NULL   NULL  //Rate//RateAlexAttwood    NULL    NULL    NULL    NULL    0

I would assume that the TabID ( 915) and the Tab Path are the main fields i want.  These will change for every politican.

915 +  //Rate//RateAlexAttwood

but how do i go from having "915" + "//Rate//Rate/AlexAttwood" to having

http://r8yourpolitician.co.uk/Rate/Ratealexattwood/tabid/915/Default.aspx

I am thinking that i need to do a select on the tabs table and extract these two coulmns trim the two "//" and then insert them into two variables,then when i am doing my insert of the string with the image break it up

for example

do selectand get the tabid and tabpath

var1 = tabID

var2 = TabPath

 

INSERT INTO [dbo].[dnnfusion_mp_Module_MyText]
           ( [UserProfileModuleId] ,[Body] )
    

VALUES
           (UserProfileModuleId, "http://r8yourpolitician.co.uk/" + TabPath + "tabid/" + tabID "/Default.aspx" ,)

The problem is that the tab path has double forward slashes in it , how can i get rid of them.  Is their a way I can clean up the TabPath so that it does not have the double forward slashes. 

The tab path comes out like this :> "//Rate//Rate/AlexAttwood" i want it to be like this  "/Rate/Rate/AlexAttwood"

any ideas community?

 
New Post
3/17/2009 12:01 AM
 

I have got to this stage but the query either hangs or is taking super super long to execute

 

declare @tabId int
declare @tab2 varchar(1000)
declare @tabPath varchar(1000)
DECLARE @mycur CURSOR
DEclare @pot int
set @pot = 2569
set @tabId = 0
set @tabPath = ''

SET @mycur = CURSOR
FOR
SELECT [TabID],[TabPath]
FROM [freedom_ukr8].[dbo].[testTab]
WHERE TabID >= '217'

OPEN @mycur

FETCH NEXT FROM @mycur INTO @tabId, @tabPath

WHILE @@FETCH_STATUS = 0
BEGIN


set @tab2 = convert(varchar,@tabId)

UPDATE [freedom_ukr8].[dbo].[dnnfusion_mp_Module_MyText]
   Set [Body] = '&lt;p&gt;&lt;a href=&quot;http://r8yourpolitician.co.uk'+ @tabPath + '/tabid/' + @tab2 + '/Default.aspx&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;/Portals/0/ratemeUK.png&quot; /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;'
   WHERE UserProfileModuleId = (SELECT UserProfileModuleId from [freedom_ukr8].[dbo].[dnnfusion_mp_UserModules]WHERE UserProfileModuleId = @pot)
set @pot = @pot + 1

FETCH NEXT FROM @mycur INTO @tabId, @tabPath
END
DEALLOCATE @mycur

 
New Post
3/17/2009 4:16 AM
 

 please be aware, that cursor driven procedures are always tend to be less performant than select driven statements. If you are able to convert the statement to an update (with subqueries or whatever) it might be a solution. If you need to do it with a cursor, consider to execute it from business login in your module instead.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/25/2009 1:01 PM
Accepted Answer 

Thanks for the reply,

 

I sorted it out, i extracted the tabID and tabPath to a temp table, i made sure i had them in ASC order which is what i needed,  I then clensed the data, when i examined the results of what i was getting from the SELECT statement with what was stored in the temp table i found that some entries should not have been there and it was because of these entries it was throwing everything off.

Once I had the results matching what I had in the temp table i simply updated what i needed to and the problem was solved ,  it was pretty straight forward it just needed a bit of focus and drive to get it done.  Now its done I feel a lot better the site is now almost ready to launch, just a bit of content to do.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to get a DNN URL from the Database so it can be used in SQLHow to get a DNN URL from the Database so it can be used in SQL


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out