Thursday, 27 March 2014

Default value for SQLServerDatasource string parameter must contain a default value to be passed as empty string!

Scenario:
- FormView in edit mode with SQLServerDatasource update statement set to a stored procedure which contains a string, nvarchar(max), parameter.
- Within the aspx file, the default parameter value = ""
- Parameter is data binded to an empty TextBox.
- FormView is submitted for update.

Observation:
- Stored procedures string parameters when defaulted as empty strings, they are not passed to the stored procedure, rather than passed as empty strings.

Workaround# 1:
- Insert a space with the parameter default value in the aspx file such that:
default = " " rather than default = " ".

Workaround# 2:
- Handling the event SQLServerDataSource.Updating, so that to manually add a space within the parameter value when the TextBox.Text value is empty.


- Visual Studio 2013, version 12.0.30110.00 Update 1
- .NET Framework 4.0

Wednesday, 26 February 2014

Determine user membership in active directory domain groups

C:>NET USER  /DOMAIN <username>
The request will be processed at a domain controller for domain <domain name>.

User name                    <username>
Full Name                    <FillName>
Comment
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never

Password last set            09/02/2014 12:01:44 PM
Password expires             Never
Password changeable          09/02/2014 12:01:44 PM
Password required            Yes
User may change password     No

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   Never

Logon hours allowed          All

Local Group Memberships
Global Group memberships     *Domain Users         *Domain_2
The command completed successfully.

Wednesday, 19 February 2014

The database principal owns a database role and cannot be dropped.

SQL Command:
DROP USER [User_NAME]

Error Message:
The database principal owns a database role and cannot be dropped.

Solution:
SELECT T2.Name, T1.Name
FROM sys.database_principals AS T1 JOIN sys.database_principals AS T2 ON T1.owning_principal_id = T2.principal_id
 WHERE T1.type = 'R' AND T2.name = 'USER_NAME'

Output:
Database roles from which to remove this user before re-trying the deletion.

Sunday, 16 February 2014

Replace your iTunes media Library by an existing media library

1) Change iTunes library:
Hold down Shift while clicking on the iTunes shortcut.



Choose Libarary... to point to your original library

2) Import existing library folders:
File menu is not enabled by default, to enable it press Alt + F

File --> Add Folder to Library... (Select your original library folder)



-- iTunes 11.1.4.62 (Windows)

Monday, 10 February 2014

SharePoint: Calculating duration in days

Create a new calculated column with the formula:

=IF(OR(ISBLANK([Start Date]), ISBLANK([End Date])),"",DATEDIF([Start Date],[End Date],"d"))

The outcome will be the number of days difference for [End Date] -[Start Date]

Thursday, 6 February 2014

Warning: Unable to update auto-refresh reference...

e.g.Unable to update auto-refresh reference 'ajaxcontroltoolkit.dll'.

I deleted the .refresh file for the problematic dlls; that solved it!


Wednesday, 22 January 2014

Wednesday, 15 January 2014

Enabling Microsoft IIS logging feature

1) Notice the Site ID, since this will guide you later to the correct logs file for your site, in case multiple sites are hosted under the same IIS instance.


2) Open "Logging" from the "Featues View".


3) Notice the target logs location when the logs are stored, and make any required changes to the log content.




4) Sample log file should look like:



5) Lookup the status code against the below MSDN list of HHTP status codes:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384325(v=vs.85).aspx


---
Snapshots from IIS version 7.5.7600 under Windows 7 Professional.