Tuesday, March 22, 2011

LINQ to SQL Sample

DataClassesDataContext dataContext = new DataClassesDataContext();

DataTable dtEmployees = new DataTable();

var employees = from empTable in dataContext.Employees
select empTable;
foreach (Employee empRecord in employees)
{
   Response.Write(empRecord.LoginID + "
");
}

dtEmployees = (DataTable)employees;
dgEmployeesList.DataSource = dtEmployees;
dgEmployeesList.DataBind();

Stored Procedure Sample

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [HumanResources].[uspUpdateEmployeeHireInfo]
@EmployeeID [int],
@Title [nvarchar](50),
@HireDate [datetime],
@RateChangeDate [datetime],
@Rate [money],
@PayFrequency [tinyint],
@CurrentFlag [dbo].[Flag]
WITH EXECUTE AS CALLER
AS

BEGIN

SET NOCOUNT ON;

BEGIN TRY

BEGIN TRANSACTION;
UPDATE [HumanResources].[Employee]
SET [Title] = @Title
,[HireDate] = @HireDate
,[CurrentFlag] = @CurrentFlag
WHERE [EmployeeID] = @EmployeeID;

INSERT INTO [HumanResources].[EmployeePayHistory]
([EmployeeID]
,[RateChangeDate]
,[Rate]
,[PayFrequency])
VALUES (@EmployeeID, @RateChangeDate, @Rate, @PayFrequency);

COMMIT TRANSACTION;

END TRY

BEGIN CATCH
-- Rollback any active or uncommittable transactions before
-- inserting information in the ErrorLog

IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRANSACTION;
END


EXECUTE [dbo].[uspLogError];

END CATCH;

END;

Tuesday, October 26, 2010

Clearing the Cache in SharePoint

In case you encounter the Update Conflict Error:

1. Stopping wss timer job, Saving Copy of the cache.ini file from C:\Documents and Settings\All Users\application data\Microsoft\SharePoint\Config folder. Clearing all the .xml files from the location except cache.ini but Edit the cache.ini to have value 1. Starting the timer job

2. Rerun the Sharepoint technology wizard on the server.

3. If all above doesnt work, you may run the configuration wizard. select the option to disconnect the server from server farm and revert back again at next step (so you actually do not disconnect). Selected the option as not to disconnect from server farm and ran the wizard successfully.

http://blogs.technet.com/corybu/archive/2007/05/31/sharepoint-orphans-explained.aspx

Monday, October 25, 2010

MOSS 2007 Backup & Restoration

Back up a farm by using SQL Server tools (Office SharePoint Server 2007)

http://technet.microsoft.com/en-us/library/cc263069(v=office.12).aspx

Restore a farm by using SQL Server tools (Office SharePoint Server 2007)
http://technet.microsoft.com/en-us/library/cc262197(v=office.12).aspx

Tuesday, July 20, 2010

SharePoint Patterns & Practices

The download includes patterns & practices for both SharePoint 2007 and 2010, applicable for implementing content-driven or event-driven SharePoint applications as well as integrating line of business applications.
http://msdn.microsoft.com/en-us/library/dd203468.aspx

Must read.

Thursday, June 10, 2010

Notes on Workflows

  • TaskName_MethodInvoking
  • Listen Activity
    • OnWorkflowItemChanged
    • OnWorkflowItemDeleted
  • WorkflowProperties.Item("Name").String

Wednesday, June 9, 2010

SharePoint Version

From the Site Settings Page
  • Go to Site Actions > Site Settings
 From the Central Administration Page
  • Go to SharePoint 3.0 Central Administration
  • Operations > Servers in Farm