Jacob's Other Blog

Syndicate content
Updated: 22 hours 2 min ago

SQL Server connection problems

December 6, 2011 - 17:09

I ran into a problem whereby my SQL Server jobs wouldn't run. I received this warning in the log:

The program sqlservr.exe, with the assigned process ID 4724, could not authenticate locally by using the target name MSSQLSvc/dev2.[DOMAIN]:[PORT]. The target name used is not valid. A target name should refer to one of the local computer names, for example, the DNS host name. Try a different target name.

I also saw this message:

The login is from an untrusted domain and cannot be used with Windows authentication.

I had moved this machine from a physical to a virtual. I found the final solution here:

http://support.microsoft.com/kb/926642 (method 1 using the FQDN in the error message).

after reading this great post:
http://36chambers.wordpress.com/2010/04/08/how-to-set-up-aliases-for-nam...

Categories: Other Blogs

Display templates (partial views) in MVC 3 using Razor

November 29, 2011 - 08:52

http://stackoverflow.com/questions/6365633/what-is-the-html-displayfor-s...

This is an excellent, easy way to have a consistent user interface. You can use display templates to default values, or give all the values of a specific type the same look and feel (or do both). For example, creating the view String.cshtml inside Views -> Shared -> DisplayTemplates will affect all strings that are rendered using:


@Html.DisplayFor()

The display template, also called a partial view looks like this:


@model string

@if ((string.IsNullOrEmpty(Model)) || (string.IsNullOrWhiteSpace(Model)))
{
    <text>(not set)</text>
}
else
{
    @Model
}

Either the string is set or the text "(not set)" is displayed if there is no value, if the value is null, or if it is only white space.

Categories: Other Blogs