Wednesday, December 9, 2015

Microsoft Access Database engine 2010, did you install the 32-bit or 64-bit?

Wondering which Microsoft Access Database engine 2010 you installed? Can't remember if it was the 32-bit or 64-bit? This can help, open regedit and check the keys:
For 64-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine\InstallRoot
For 32-bit:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Access Connectivity Engine\InstallRoot

Wednesday, November 25, 2015

SSRS Multi Value Parameter. Display 'All' or Selected Parameter(s) with a comma.

This is mainly a note for myself because keep forgetting how the code works..if you have an SSRS Report with a drop-down that the user can select all, and you want to display in the report what parameters the user selected, BUT you don't want to list 1000s of selections if the user selected the 'All' option, you can display 'All' instead of each item to specifically because it takes up too much room in the report.
=IIF( Parameters!YourMultivalueParam.Count = countrows("DatasetName"), "All", Join(Parameters!YourMultivalueParam.Label,", ") )

Friday, September 11, 2015

SSRS Replace default label like 'NULL' with custom text

If you need to replace any label text in the report viewer, such as NULL, you can create the following class which implements IReportViewerMessages. This was very difficult to find figure out from my google researching. I had to piece information together from here and there to get it working for me so I am posting this today to be an 'all in one'!
I had trouble creating the class within the web application, so I had to add it to a separate project, which one already existed and was being referenced by the web project any way. I copied the dll produced by that project into the bin folder of the web project, and then added the following appSetting to the web.config file of the web project:
<add key="ReportViewerMessages" value="MyNameSpace.MyCustomReportViewerMessages, AssemblyNameOfYourProjectThatContainsThisFile"/ >
I'll be honest, big words like Assembly reference scare me. That could be any thing and is so generic sounding and it could be written so many ways, in this case NameSpace.ClassName, TheAssemblyFileName which I think boils down to the name of the dll file with out the 'dll' part.
When you run the report, you may get an invalid file exception, review what you have referenced in the web.config. I had a typo I kept overlooking.
And unfortunately, you have to 'implement' all so that means this entire file will replace every label. Double-check my work for me would ya...or risk some crazy label I missed :)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Reporting.WebForms;

namespace MyNameSpace
{
    public class MyCustomReportViewerMessages : IReportViewerMessages
    {
        //overwrite the default labels in the report viewer 

 public string NullCheckBoxText { get { return "All"; } }
        public string NullCheckBoxToolTip { get { return "All"; } }
        public string NullValueText { get { return "All"; } }

        public string DocumentMapButtonToolTip { get { return "Document Map"; } }
        public string ParameterAreaButtonToolTip { get { return "Show/Hide Parameters"; } }
        public string FirstPageButtonToolTip { get { return "First Page"; } }
        public string PreviousPageButtonToolTip { get { return "Previous Page"; } }
        public string CurrentPageTextBoxToolTip { get { return "Current Page"; } }
        public string PageOf { get { return "of"; } }
        public string NextPageButtonToolTip { get { return "Next Page"; } }
        public string LastPageButtonToolTip { get { return "Last Page"; } }
        public string BackButtonToolTip { get { return "Back"; } }
        public string RefreshButtonToolTip { get { return "Refresh"; } }
        public string PrintButtonToolTip { get { return "Print"; } }
        public string ExportButtonToolTip { get { return "Export"; } }
        public string ZoomControlToolTip { get { return "Zoom Control"; } }
        public string SearchTextBoxToolTip { get { return "Search Text"; } }
        public string FindButtonToolTip { get { return "Find Buttonp"; } }
        public string FindNextButtonToolTip { get { return "Find Next"; } }
        public string ZoomToPageWidth { get { return "Zoom To Page Width"; } }
        public string ZoomToWholePage { get { return "Zoom To Whole Page"; } }
        public string FindButtonText { get { return "Find"; } }
        public string FindNextButtonText { get { return "Find Next"; } }
        public string ViewReportButtonText { get { return "View Report"; } }
        public string ProgressText { get { return "Progress Text"; } }
        public string TextNotFound { get { return "Text Not Found"; } }
        public string NoMoreMatches { get { return "No More Matches"; } }
        public string ChangeCredentialsText { get { return "Change Credentials Text"; } }

        public string TrueValueText { get { return "True"; } }
        public string FalseValueText { get { return "False"; } }
        public string SelectAValue { get { return "Select A Value"; } }
        public string UserNamePrompt { get { return "User Name"; } }
        public string PasswordPrompt { get { return "Password Prompt"; } }
        public string SelectAll { get { return "Select All"; } }
        public string PrintLayoutButtonToolTip { get { return "Print Layout"; } }
        public string PageSetupButtonToolTip { get { return "Page Setup"; } }
        public string TotalPagesToolTip { get { return "Total Pages"; } }
        public string StopButtonToolTip { get { return "Stop"; } }
        public string DocumentMapMenuItemText { get { return "Document Map"; } }
        public string BackMenuItemText { get { return "Back"; } }
        public string RefreshMenuItemText { get { return "Refresh"; } }
        public string PrintMenuItemText { get { return "Print"; } }
        public string PrintLayoutMenuItemText { get { return "Print Layout"; } }
        public string PageSetupMenuItemText { get { return "Page Setup"; } }
        public string ExportMenuItemText { get { return "Export"; } }
        public string StopMenuItemText { get { return "Stop"; } }
        public string ZoomMenuItemText { get { return "Zoom"; } }
        public string ViewReportButtonToolTip { get { return "View Report"; } }
        public string TodayIs { get { return "Today Is"; } }
        public string ChangeCredentialsToolTip { get { return "Change Credentials"; } }
        public string DocumentMap { get { return "Document Map"; } }
        public string ExportButtonText { get { return "Export"; } }
        public string ExportFormatsToolTip { get { return "Export Formats"; } }
        public string InvalidPageNumber { get { return "?"; } }
        public string SelectFormat { get { return "Select Format"; } }
    }
}

Monday, June 29, 2015

Kendo Grid - Not Sorting when using DataSource Read for Binding

I had a Kendo Grid that was using server side binding, I think that is what it is called, to get the data. The problem I was having was the Sorting. The grid was marked Sortable() and appeared to be doing something, just not sorting! I found that if I added .ServerOperation(false) to the DataSource attributes this fixed the issue and it began sorting correctly. Not sure if there are any load consequences to this or not but it does work.
  1. @(Html.Kendo().Grid<UsageStatics>()
  2. .Deferred()
  3. .Name("MyGrid")
  4. .Columns(columns =>
  5. {
  6. columns.Bound(p => p.UserName).Title("User")
  7. columns.Bound(p => p.LoginDate).Title("Last Login")
  8. })
  9. .Pageable(pager => pager
  10. .Refresh(true))
  11. .Sortable(s => s.SortMode(GridSortMode.MultipleColumn).AllowUnsort(true))
  12. .Filterable()
  13. .Scrollable()
  14. .Events(e => e.DataBound("_onDataBound"))
  15. .DataSource(dataSource => dataSource
  16. .Ajax()
  17. .PageSize(200)
  18. .Events(events => events.Error("errorHandler"))
  19. .ServerOperation(false) //allows sorting...
  20. .Read(read => read.Action("GetUsers", "MyControllerName").Data("gridData"))
  21. )
  22. )

Friday, June 26, 2015

Report Viewer Not Running Local Report in IE11

I was working on a project that ran local SQL Reports using the Report Viewer control. As I was working with the reports, I was only testing in FireFox which was fine, however, I later found that the reports were not running in IE! I was running IE11 at the time. There are numerous fixes for this issue including adding the meta tag (which did not work for me). I selected the modification to the Global.asax file and that corrected the issue.
I am running MVC, .NET Framwork 4
  1. protected void Application_BeginRequest(object sender, System.EventArgs e) {
  2. // Bug fix for MS SSRS Blank.gif 500 server error missing parameter IterationId
  3. // https://connect.microsoft.com/VisualStudio/feedback/details/556989/
  4. if (HttpContext.Current.Request.Url.PathAndQuery.StartsWith("/Reserved.ReportViewerWebControl.axd") &&
  5. !System.String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ResourceStreamID"]) &&
  6. HttpContext.Current.Request.QueryString["ResourceStreamID"].ToLower().Equals("blank.gif"))
  7. {
  8. Context.RewritePath(System.String.Concat(HttpContext.Current.Request.Url.PathAndQuery, "&IterationId=0"));
  9. }
  10. }

Thursday, March 12, 2015

IE 11 Cookie Info in URL - Log out

I recently encountered a bug only in IE (11). Each time a user would log in on the production server using IE the url would populate with extra information (it looks like cookie information). Like this:
http://www.mysite.com/(R(ffdsfsdfsddsfdsfdseqqc3rjy))/default.aspx
The site worked fine until the user needed to submit data by clicking the Submit button, instead of posting the form it would head over to the login screen! This did not seem to be a problem on my local machine using the VS debugger.
The code is ASP.net MVC 4.0. I had not see this before but I found a link that had my answer:
http://stackoverflow.com/questions/19725827/internet-explorer-11-session-issue-with-asp-net-4-0
The fix is to change the web.config to include the cookieless attribute.
  1. <authentication mode="Forms">
  2. <forms loginUrl="~/YourLoginUrl" timeout="2880" cookieless="UseCookies" />
  3. </authentication>
Hope that helps!