Friday, February 17, 2012

Sharepoint - SPSecurityTokenServiceConfig is not recognized

i try to run SET-SPSecurityTokenServiceConfig command in powershell, but it return me error message
" SET-SPSecurityTokenServiceConfig recognized as the name of cmdlet, function..."

Add-PSSnapin Microsoft.SharePoint.Powershell

After this, sharepoint commands will be available in PowerShell.

Wednesday, February 15, 2012

Microsoft.Ace.OLEDB.12.0 and OPENROWSET Errors

If you imports excel file into database using sql query 

INSERT INTO newtable
select  * FROM
OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\temp.xls;HDR=YES', 'SELECT * FROM [sheet$]')

and get below error message

Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.Ace.OLEDB.12.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "Microsoft.Ace.OLEDB.12.0" for linked server "(null)".

please run 2 sql below to solve it

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1