p jha
 New Member Posts:1
 |
| 07 Sep 2006 03:01 PM |
|
Hi All,
Why does a SQL script in VS2003 or in Enterprise Manager runs on my DNN database and returns rows while the same script doesn't return rows in the SQL View module (no errors). It only shows the table header with the column names: DateTime and Hours Ago
This is the script i use:
--------------------------------------------------
SELECT TOP 1 DateTime, CAST(DATEDIFF(minute, DateTime, GETDATE()) / 60.00 AS decimal(9, 2)) AS [Hours Ago]
FROM dbo.SiteLog
WHERE (PortalId = 2) AND (UserAgent LIKE '%googlebot%')
ORDER BY DateTime DESC
--------------------------------------------------
Do i need a XSL file for displaying data?
Any help would be appreciated.
Chau,
Zit.
|
|
|
|
|
Richard Edwards DNNStuff Founder
 Veteran Member Posts:1207

 |
| 08 Sep 2006 01:10 PM |
|
No, you don't need any xsl file Chau.
Try a simple query such as
[code]SELECT * FROM dbo.Portals[/code]
Does that work?
|
|
Richard Edwards DNNStuff Founder Did you receive excellent support? Consider leaving a testimonial |
|
|
Sandro Seiler
 New Member Posts:1
 |
| 23 Sep 2006 02:17 PM |
|
Hello.
First I want to thank you for the samples and free modules you have published in your site.\
After using the SQL View module, I get no rows.
I tried using the code
SELECT * FROM dbo.Portals and this works fine, however the sample sql code you have to retrieve last googled info will not work. Any help is appreciated.
F10 |
|
|
|
|
Richard Edwards DNNStuff Founder
 Veteran Member Posts:1207

 |
| 23 Sep 2006 08:55 PM |
|
Ok, I think I know now.
In the code you are using, it specifies portal 2 which is my portal number but it may not be the same for yours.
In that code, replace the 2 with [DNN:PortalId] which will insert the portal id into your query string.
The query should look like:
[code]SELECT TOP 1 DateTime, CAST(DATEDIFF(minute, DateTime, GETDATE()) / 60.00 AS decimal(9, 2)) AS [Hours Ago]
FROM dbo.SiteLog
WHERE (PortalId = [DNN:PortalId]) AND (UserAgent LIKE '%googlebot%')
ORDER BY DateTime DESC[/code]
|
|
Richard Edwards DNNStuff Founder Did you receive excellent support? Consider leaving a testimonial |
|
|