Data-driven subscriptions cannot be created

Tuesday, August 18, 2015 0 comments
So you get this wonderful error from SQL Server Reporting Services when you try to add a data driven subscription to your report:

Data-driven subscriptions cannot be created because the credentials used to run the report are not stored, the report is using user-defined parameter values, or if a linked report, the link is no longer valid.
You look and you are using a shared data source that has saved credentials.  So that's not it.

You check and the report is not linked to any other report.  So that's not it.

You go ahead and remove all the parameters and publish.  So that's not it.

Is SSRS a liar?  Dumb Microsoft goofed again right.  Not so fast.  This is still something you can fix.  I came across something that could help.  Check on the Variables section.

In the rdl file's xml there is a <Variables></Variables> section.  Remove it and publish.  The error will go away.  You can also see it in the Report Properties.



You'll see a variable there that needs to be deleted, if this solution is a solution to your problem.



Good luck and I hope this helped.


QUOTED_IDENTIFIER Gotcha!

Thursday, July 9, 2015 0 comments
This one is new for me. It might be something you have to consider all the time. I do not.

Stored procedures in SQL may have defaults for certain options set only at creation. So you can't override them or even alter them. You have to drop and recreate them if those options have an affect on your query.

This probably doesn't affect 99% of your queries. It doesn't affect mine too much. Today I had to so a bit of XML in my stored procedure though. It worked in dev fine because of course my options are set differently than in another server. When I gave the script to someone else to try... whammo!
SELECT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'




What the hell does that mean? Is this Office Space? PC LOAD LETTER!

No it's not a movie. This is real life and SQL has this cool table called sys.sql_modules. It can store options that you have set when you created that bloody stored procedure that isn't working now.

SELECT name = OBJECT_NAME([object_id]), uses_quoted_identifier
FROM sys.sql_modules
WHERE OBJECT_NAME([object_id]) IN (N'sproc1', N'spoc2');


In this example our stored procedure is called sproc1. The columns we can look for are:
  • object_id
  • definition
  • uses_ansi_nulls
  • uses_quoted_identifier
  • is_schema_bound
  • uses_database_collation
  • is_recompiled
  • null_on_null_input
  • execute_as_principal_id

For this example our results prove that we do have a problem.

name uses_quoted_identifier
---- ---------------
sproc1 0
sproc2 1

So how do we fix this. We can't do an alter. We have to recreate the stored procedure. Yep, what a pain in the butt.  It's because of the darn XML and STUFF() that we are doing to put some rows all together into a delimited string.  Please don't focus on that.. it's the QUOTED_IDENTIFIER ON that is the bug.

--drop the sp and recreate with the correct set options.

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[
sproc1]') AND type in (N'P', N'PC'))

DROP PROCEDURE [dbo].[
sproc1]

GO

-- important

SET ANSI_NULLS ON
GO

-- important for xml queries

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[
sproc1]
AS
BEGIN

-- important for mapping in Entity Framework
SET FMTONLY OFF

-- SELECT an existing row from the table.

CREATE TABLE #Things
(
[Id] INT,
[Description] VARCHAR (200),
[Date] DATETIME NOT NULL
)

INSERT INTO #
Things(Id, Description, Date)
SELECT ID, Description, Date
FROM TableA
INNER JOIN 
TableB ON TableB.ID = TableA.ID
WHERE Description IS NOT NULL

SELECT a.Id,
STUFF((
SELECT ', ' + b.Description
FROM #
TableA b
WHERE (b.Id = a.Id)
FOR XML PATH(''),TYPE).value('(./text())[1]','VARCHAR(MAX)')
,1,2,'') AS
Things 
FROM #
Things a
GROUP BY Id

DROP TABLE #
Things

END

GO

Recruiters should not call or email me.

Wednesday, February 25, 2015 0 comments
I have changed positions over the years. It does happen. I do answer my phone and read my email. I like talking to other developers and entrepreneurs about technology. Sometimes that might involve me coding for them or with them.

I don't like it when a recruiter calls me up looking to place someone they know or wanting to fill a role they have. Please don't bother me. I won't be nice to you when you call and I'll block your email.

You can contact me on LinkedIn if you want. That is what LinkedIn is for. Calling me up at all hours of the day and night isn't going to help you, at all.

The ActionName attribute is very powerful in Sitefinity

Friday, October 3, 2014 0 comments
If you haven’t heard, Sitefinity allows for not only ASP.NET WebForms development but also ASP.NET MVC development.  http://www.sitefinity.com/mvc-cms There are different modes to MVC development in Sitefinity: Classic, Pure, and Hybrid.  I think the most common would be hybrid.  If you have an existing site and add a new MVC widget, you’re probably going to use Hybrid.

Code in Hybrid mode is a mix of WebForms in your MasterPages and Razor ASP.NET MVC in your widgets.  The routes in Hybrid mode are mixed also.  I mean to say that the routes are built for WebForms to work first and MVC second. Because of this you need to pay attention to the ActionName attribute on your control ActionResults and also your form tags.
Your controller
   1: /// <summary>
   2: /// This is the success Action.
   3: /// </summary>
   4: [ActionName("Success")]
   5: public ActionResult Success()
   6: {
   7: LoginModel model = new LoginModel();
   8: return View(model);
   9: }
  10:  
  11: [HttpPost]
  12: [ActionName("Success")]
  13: public ActionResult Success(LoginModel model)
  14: {
  15: if(ModelState.IsValid)
  16: {
  17:  
  18: }
  19: return View(model);
  20: }

Note that we use the ActionName attribute “Success”.  Normally you don’t have to do this.  The ActionName is inferred from the method name.  In Sitefinity Hybrid mode this is not the case.

Your view
   1: @model SitefinityWebApp.Mvc.Models.LoginModel
   2: <h1>
   3: @ViewData["HeaderText"]
   4: </h1>
   5: @using (Html.BeginFormSitefinity("Success", "<NAME OF WIDGET>", FormMethod.Post))
   6: {
   7:
   8: }

In your MVC view, you’ll use the helper BeginFormSitefinity.  A good convention is to use the name of the widget as the form name and we need to use the ActionName attribute “Success” in this sample to match our controller.  Here we are posting a form with inputs.

I hope this explains the power of ActionName.  It is seldom used it normal MVC development but necessary to Sitefinity MVC development.

My New Home Away From Home

Monday, January 27, 2014 0 comments

For those of my readers that have missed me, I’m going to try to write more in 2014.  So for my first post of the new year, I want to talk about what I’ve been doing the last 6 months.  I’ve been onboarding as Director of Application Development at Foundation 648, Inc. F648 is a 4 year old .NET shop here in Indiana.  It was started by Patrick Poer and Buck Brian.  After meeting them we just hit it off.  I’m still learning about all they did in the past and we are expanding our capabilities rapidly.  It’s really challenging and I’m having a heck of a great time.

 

We recently moved into some permanent space with room to grow.  The new address is 11711 N. Pennsylvania St, Suite 255, Carmel, IN 46032.  We currently have space for 5 or 6 more developers and can easily expand down the hall.  It’s a great environment and we are hiring.

 

Here are some pictures of the my new home away from home.  I have a really nice office and all the bruises have healed from moving desks.  We work hard at F648 and love to do everything ourselves. 

 

Go thru the main entrance in the rear.  There is retail in the front and office space in the back of 11711.

 

WP_20140127_014

Take the elevator upstairs

 

WP_20140127_013

 

After you get to the 2nd floor turn right

 

WP_20140127_011

 

Suite Entry

 

WP_20140127_010

 

Reception Area

 

WP_20140127_009

 

Break room

 

WP_20140127_008

 

Developer Pit

 

WP_20140127_006

 

Hallway

 

WP_20140127_004

 

President’s Office with a door to the deck

 

WP_20140127_003

 

My Office, no door but a great view

 

WP_20140127_002

dotNetConf - .NET Open Source Panel

Thursday, June 13, 2013 0 comments
I'm just catching up on some videos that I promised myself to go back and watch.  This one is cool.  Great panel included OpenRasta and ServiceStack developers among others.



Kendo UI window not centering for you?

Thursday, March 28, 2013 0 comments


I recently had to build a new site and I wanted to use Kendo UI.  It's really good stuff and there are plenty of samples.  The thing about learning from samples is that sometimes the sample is incomplete.  Like this weird thing I noticed with the code I downloaded from https://github.com/telerik/kendo-music-store.  When you click an item in the ListView it opens detail in a Kendo Window.  Pretty cool, but it's not centered.  It puts the window at the bottom of the window for some reason.


Let's look at the code (/Scripts/App/store.js).


_openWindow = function (template, viewModel) {
            // Create a placeholder element.
            var window = $(document.createElement('div'));
 
            // Apply template to the placeholder element, and bind the viewmodel.
            var templateHtml = $(template).html();
            window.html(kendo.template(templateHtml)(viewModel));
            kendo.bind(window, viewModel);
 
            // Add window placeholder to the body.
            $('body').append(window);
 
            // Turn placeholder into a Window widget.
            window.kendoWindow({
                width: config.albumDetailsWindowWidth,
                title: viewModel.data.Title,
                resizable: false,
                close: function () {
                    // When the window is closed, remove the element from the document.
                    window.parents(".k-window").remove();
                }
            });
 
            // Center and show the Window.
            window.data("kendoWindow").center();
            window.data("kendoWindow").open();
        },

First, you can chain the center and open together.  Does this fix the centering issue? No.  But it's less code.
 
Copyright © Aaron Stanley King