Monday, September 26, 2016

Configuring IIS Express failed with the following error Unable to access the IIS metabase


After installing Visual Studio 2013 and opening my solution, I received the below error:

Configuring IIS Express failed with the following error:
Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.

The root problem was that the "My Documents" folder had setup to be on a network share, and the share was not accessible. Once I changed the "My Documents" folder location to a local folder (by modifying the registry value), it started working again.


Changing this key worked for me:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal


I know that this may not be a common scenario that you might run into, but I've posted it here because it gives the same symptoms.
Registry Editor




Thursday, October 8, 2015

How To Use a .NET 2.0 Runtime DLL From .NET 4.0 Windows Forms application?

I had a requirement to use a .NET dll assembly that was built against version 'v2.0.50727'to reference to it in my .Net Framework 4.0 windows forms application.

After referencing the dll, compilation error occurred in the application - "are you missing a using directive or an assembly reference."

Reason: As the DLL is a CLR 2.0 runtime assembly, it cannot be loaded in the 4.0 runtime.


Solution:

You will need to set useLegacyV2RuntimeActivationPolicy to true in app.config file. This is required to use mixed mode CLR 2 assemblies(targeting version 2.0.50727 of the CLR), in a .NET 4 application.

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>


Friday, June 21, 2013

No export DLLs found error – Crystal Reports


While attempting to export the crystal report on a terminal server, it resulted in the following run-time error:

"No export DLLs found".


This errors message appears because the application cannot find the export DLLs on terminal server environment.

Solution

I copied all the below export related dlls (U2*.dll) that are in C:\Windows\CRYSTAL Folder to C:\Windows\System32 Folder. The problem is very well solved.

Crystal Report Export Dlls

Dll NameDESCRIPTION
U2DAPP.DLLApplication destination
U2DDISK.DLLDisk file destination
U2DMAPI.DLLMAPI format (Microsoft Mail, Microsoft Exchange)
U2DNOTES.DLLLotus Domino destination
U2DPOST.DLLMicrosoft Exchange Public Folders
U2DVIM.DLLVIM destination
U2FCR.DLLCrystal Reports format
U2FDIF.DLLDIF format
U2FHTML.DLLHTML format See HTML under Additional Components for additional runtime information.
U2FODBC.DLLODBC data source
CRXF_PDF.DLLPDF format Replaces U2FPDF.DLL from version 8.See Page Ranged Export under Additional Components for additional runtime information.
U2FRDEF.DLLReport Definition format
U2FREC.DLLRecord format
CRXF_RTF.DLLRich Text FormatReplaces U2FRTF.DLL from version 8 and earlier.See Page Ranged Export under Additional Components for additional runtime information.
U2FSEPV.DLLComma Separated Values format
U2FTEXT.DLLText format
U2FWKS.DLLLotus 1-2-3 format
U2FWORDW.DLLMicrosoft Word for Windows format
U2FXML.DLLXML format
U2FXLS.DLLMicrosoft Excel format

Thursday, June 10, 2010

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

SQL Errors and Solutions,The conversion of a varchar data type to a datetime data type resulted in an out-of-range value,SQL,SQL tips

SQL Server Error Message:

 The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

This error occurs when the varchar value does not form a valid date.

Error Message:


Server: Msg 242, Level 16, State 3, Line 1

The conversion of a char data type to a datetime data

type resulted in an out-of-range datetime value.
 

Causes:

This error occurs when trying to convert a string date value into a DATETIME data type but the date value contains an invalid date. The individual parts of the date value (day, month and year) are all numeric but together they don’t form a valid date.


To illustrate, the following SELECT statements (all based on US date format MM/DD/YYYY)will generate the error:

SELECT CAST('02/29/2006' AS DATETIME) -- 2006 Not a Leap Year   

SELECT CAST('06/31/2006' AS DATETIME) -- June only has 30 Days   

SELECT CAST('13/31/2006' AS DATETIME) -- There are only 12 Months

SELECT CAST('01/01/1600' AS DATETIME) -- Year is Before 1753


Another way the error may be encountered is when the format of the date string does not conform to the format expected by SQL Server as set in the SET DATEFORMAT command. For example, in United

To illustrate, if the date format expected by SQL Server is in the MM-DD-YYYY (US date format) format, the following statement will generate the error:

SELECT CAST('31-01-2006' AS DATETIME)

Solution/Workaround:

To avoid this error from happening, you can check first to determine if a certain date in a string format is valid using the ISDATE function. The ISDATE function determines if a certain expression is a valid date. So if you have a table where one of the columns contains date values but the column is defined as VARCHAR data type, you can do the following query to identify the invalid dates:

SELECT * FROM [dbo].[Orders]
WHERE ISDATE([OrderDate]) = 1

Once the invalid dates have been identified, you can have them fixed manually then you can use the CAST function to convert the date values into DATETIME data type:

SELECT CAST([OrderDate] AS DATETIME) AS [Order Date]
FROM [dbo].[Orders]

Another way to do this without having to update the table and simply return a NULL value for the invalid dates is to use a CASE condition:

SELECT CASE ISDATE([OrderDate]) WHEN 0
THEN CAST([OrderDate] AS DATETIME)
ELSE CAST(NULL AS DATETIME) END AS [Order Date]
FROM [dbo].[Orders]

Wednesday, June 9, 2010

Unable to find the requested .Net Framework Data Provider. It may not be installed.

SQL Errors and Solutions,.NET Errors and Solutions,Unable to find the requested .Net Framework Data Provider. It may not be installed.,.NET

I got this error "Unable to find the requested .Net Framework Data Provider. It may not be installed." when I try to retrieve the data from SQL Server.

Reason:


Whoo!!

I had wrongly mentioned the Data provider name in my dll.

I had mentioned as

Conndll.ProviderName = "System.Data.Sqlclient" 'c in client should have been upper case letter

instead of

Conndll.ProviderName = "System.Data.SqlClient"

Thursday, May 27, 2010

Convert CYYMMDD format to datetime - SQL

Convert CYYMMDD to DateTime,Convert CYYMMDD to DateTime Format,SQL,SQL Query,AS400 datetime
In the date format CYYMMDD(AS400 date format), C is Century.

If C is 0 the year is 19XX, and it is 20XX if C is 1(Where XX can be any
two digit year).

YYMMDD is Year Month and Day(All two digit).

In CYYMMDD format, today's date (May 27, 2010) would be 1100527.

It is '0' for 19 and '1' for 20 to make our comparisons easy.

But the '0' will not present in the table data as the leading zeroes of numeric will be truncated.

The following query converts the CYYMMDD format to datetime format:

SELECT dbo.TBL.ACTDT  AS ActualDate, CAST(CASE WHEN SUBSTRING(RIGHT('00' + CAST(dbo.TBL.ACTDT AS VARCHAR), 7), 1, 1) = '0' THEN '19' ELSE '20' END + SUBSTRING(RIGHT('00' + CAST(dbo.TBL.ACTDT AS VARCHAR), 7), 2, 2) + SUBSTRING(RIGHT('00' + CAST(dbo.TBL.ACTDT AS VARCHAR), 7), 4, 4) AS DATETIME) AS [Converted Date] FROM TBL


Query Result:

Convert CYYMMDD Format to datetime format

Invalid object name 'INFORMATION_SCHEMA.tables' - SQL Error

Invalid object name 'INFORMATION_SCHEMA.tables',SQL Errors and Solutions,SQL

The error Invalid object name 'INFORMATION_SCHEMA.tables' was thrown when I executed the  following query,

Select * from INFORMATION_SCHEMA.tables

for a particular database.

Reason: The particular database was case sensitive.

Solution:
I re-ran the same query with upper-case letters and it worked fine.

Select * from INFORMATION_SCHEMA.TABLES - did the trick for me.

Google Chrome browser keyboard shortcuts

Ctrl-Alt-Del in Remote Desktop Connection Window,Remote Machine, Keyboard Shortcuts
Google Chrome offers some tips on keyboard shortcut for easy navigation and operation. The below keyboard hotkeys or accelerators are the lists of common and useful built-in shortcuts .

CTRL + SHIFT + N : automatically opens up a Chrome ‘incognito’ window which allows you to surf on a PC without leaving behind any digital footprints.

SHIFT + Escape: allows for fast access to Chrome’s task Manager utility that allows you to nix browser processes that have gone awry.

CTRL + SHIFT + T: will open recently closed browser tabs.

Window And Tab Shortcuts:

Ctrl+N – Open a new window

Ctrl+Shift+N – Open a new window in incognito mode

Press Ctrl,and click a link – Open link in a new tab

Press Shift, and click a link – Open link in a new window

Alt+F4 - Close current window

Ctrl+T - Open a new tab

Ctrl+Shift+T – Reopen the last tab you’ve closed. Google Chrome remembers the last 10 tabs you’ve closed.

Drag link to tab – Open link in specified tab

Drag link to space between tabs – Open link in a new tab in the specified position on the tab strip

Ctrl+1 through Ctrl+8 – Switch to the tab at the specified position number. The number you press represents a position on the tab strip.

Ctrl+9 – Switch to the last tab

Ctrl+Tab or Ctrl+PgDown – Switch to the next tab

Ctrl+Shift+Tab or Ctrl+PgUp – Switch to the previous tab

Ctrl+W or Ctrl+F4 – Close current tab or pop-up

Alt+Home – Open your homepage

Ctrl+O, then select file – Open a file from your computer in Google Chrome


Shortcuts To Open Google Chrome Features:

Ctrl+B – Toggle bookmarks bar on and off

Ctrl+H – View the History page

Ctrl+J – View the Downloads page

Shift+Escape – View the Task manager

Webpage Shortcuts:

Ctrl+P – Print your current page

F5 – Reload current page

Esc – Stop page loading

Ctrl+F5 or Shift+F5 – Reload current page, ignoring cached content

Press Alt, and click a link – Download link

Ctrl+F – Open find-in-page box

Ctrl+G or F3 – Find next match for your input in the find-in-page box

Ctrl+Shift+G or Shift+F3 – Find previous match for your input in the find-in-page box

Ctrl+U – View source

Drag link to bookmarks bar – Bookmark the link

Ctrl+D – Bookmark your current webpage

Ctrl++ – Make text larger

Ctrl+- – Make text smaller

Ctrl+0 – Return to normal text size

Text shortcuts:

Highlight content, then press Ctrl+C – Copy content to the clipboard

Place your cursor in a text field, then press Ctrl+V or Shift+Insert – Paste current content from the clipboard

Place your cursor in a text field, then press Ctrl+Shift+V – Paste current content from the clipboard without formatting

Highlight content in a text field, then press Ctrl+X or Shift+Delete – Delete the content and copy it to the clipboard

Ctrl-Alt-Del in Remote Desktop Connection Window

Ctrl-Alt-Del in Remote Desktop Connection Window,Remote Machine, Keyboard Shortcuts

Ctrl-Alt-Del keyboard shortcut has been commonly used since IBM PC with DOS era to perform soft reboot, and used in modern Windows system to activate Winlogon process (log on to Windows NT), open Task Manager or Windows Security dialog box that allows user to log off, lock computer, shutdown PC, run Task Manager, switch user and other functions.

However, whenever trying to trigger Ctrl-Alt-Del function on remote system connected via Remote Desktop Connection, the keyboard shortcut combination pressed will bring up the Ctrl+Alt-Del function on the local machine instead of the machine remotely logged on via RDC.

This behavior is by design though, as Ctrl-Alt-Del key combination is too important for any PC (to run especially when computer encounters halt error or hang). As such, Ctrl-Alt-Del keyboard shortcut is always reserved for local host computer.

In order to send Ctrl-Alt-Del keystrokes to remote computer connected via Remote Desktop client, just press the following Key combination:

Ctrl+Alt+End

a work around keyboard shortcut specially for Remote desktop machine.

Thursday, May 6, 2010

Not enough storage is available to process this command

Not enough storage is available to process this command
I recently faced an issue in the development server, the error message "Not enough storage is available to process this command" popped up when try to ran the longer query in the sql server.


Not enough storage is available
Not enough storage is available to process this command





The reason for the error was due to the  IPRStackSize registry entry was missing or setting too low.

In my case the IPRStackSize registry entry was missing .

To resolve these errors I did the following:

1) Start -> Run ->Type regedit
2) Locate and click the following entry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

3)If the IRPStackSize entry is not present in this subkey, follow these steps:


   Click Edit, point to New, and then click DWORD Value.

   Type IRPStackSize, and then press ENTER.

   Note: Type IRPStackSize exactly as it appears. The value name is case sensitive.

4) Right Click IRPStackSize and then click Modify.

IPRStackSize


5) Select the Base as decimal. In the Data Value box, type a larger value and then click OK.

Edit IPRStackSize

Wednesday, May 5, 2010

Convert YYYYMMDD to DateTime SQL

Convert YYYYMMDD to DateTime,Convert YYYYMMDD to DateTime Format,SQL,SQL Query
The following SQL query converts the date stored as decimal or numeric in the form of YYYYMMDD to datetime.


1) SELECT CAST(CAST(YourDateField AS VARCHAR(8)) AS DATETIME)


For example:

SELECT CAST(CAST(20060204 AS VARCHAR(8)) AS DATETIME) AS [DateTime]


will be displayed as

2006-02-04 00:00:00.000

2) CONVERT(datetime, YourDateField) AS [DateTime]

     For example:


   CONVERT(datetime, '20060204') AS [DateTime]

   will be displayed as

     02/04/2006






Monday, May 3, 2010

WPF application executable path

In windows forms, Application.ExecutablePath gives the executable path of the application.

What is the alternative in WPF?



System.Reflection.Assembly.GetExecutingAssembly().Location will give the executable path of the WPF application.

Convert Julian Date YYYYDDD to Datetime Format

Convert YYYYDDD to datetime,Convert Julian Date YYYYDDD to Datetime Format,Convert Julian Date YYYYDDD to Gregarian Format,SQL,SQL Query
I got a requirement to display the date which is the format 7-digit YYYYDDD (Julian Date) to display in Gregarian format.

This is the query I wrote to convert YYYYDDD format to YYYY-MM-DD format.

YYYY - 4 - digit Year
DDD -  number of the day in the year

SQL Query:

SELECT  [Julian Date], DATEADD(DAY, [Julian Date]% 1000 - 1, DATEADD(YEAR,


[Julian Date]/ 1000 - 1900, 0)) AS [Gregarian Date]


FROM dbo.Test
 
Sample Output: