I was strugling with a workflow that the CreateTask did not create a task as expected. After googling around and it turned out that Task-related activities need a unique CorellationToken value.
There are three groups of activities with each group has it's own CorellationToken, and activities with the same group should share the same correlation token:
Workflow token:
OnWorkflowActivated
OnWorkflowItemChanged
OhWorkflowItemDeleted
SetState
SendEmail
UpdateAllTasks
Task token:
CreateTask
CreateTaskWithContentType
UpdateTask
DeleteTask
CompleteTask
RollbackTask
OnTaskChanged
OnTaskDeleted
OnTaskCreated
Modification token:
EnableWorkflowModification
OnWorkflowModified
Wednesday, 1 April 2009
SharePoint Workflow failed to start
If a workflow is created through a WSPBuilder project, the workflow would have problem to start. To solve this problem, the .csproject file needs to be modified manually. Open the project file in notepad, add the following line
Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets"
right after the line
Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"
Then problem solved.
This is really a frustrating issue.
Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets"
right after the line
Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"
Then problem solved.
This is really a frustrating issue.
Wednesday, 18 March 2009
Deploy a wss solution from Visual Studio 2008 extension for WSS has error
It's anoying to have this error when I deploy a soltion:
The feature name XXX already exists in SharePoint. You need to rename the feature before solution deployment can succeed.
To solve this problem you can't just rename the feature as that just adds more mess. The correct approach is to go to SharePoint Central Administration webiste, in the operations web, choose Solution Management.
Find that solution that causes trouble, extract that solution. Then remove that solution from the list.
After the solution is removed, the Visual Studio 2008 can deploy it to SharePoint again.
The feature name XXX already exists in SharePoint. You need to rename the feature before solution deployment can succeed.
To solve this problem you can't just rename the feature as that just adds more mess. The correct approach is to go to SharePoint Central Administration webiste, in the operations web, choose Solution Management.
Find that solution that causes trouble, extract that solution. Then remove that solution from the list.
After the solution is removed, the Visual Studio 2008 can deploy it to SharePoint again.
Wednesday, 14 January 2009
ADO closes a recordset before any data is read from a stored procedure
Recently I was working on a legacy VB Script file which has following code:
dim conn
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionTimeout = connTimeOut
conn.CommandTimeout = connCmdTimeOut
conn.Open connString
dim dbCmd
set dbCmd = CreateObject("ADODB.Command")
dbCmd.CommandTimeout = 300
dbCmd.CommandType = adCmdText
dbCmd.ActiveConnection = Conn
sqlText = "ReportScheduler '" & currentDate & "' "
dbCmd.CommandText = sqlText
dim rsScheduledReports
set GetScheduledReports = dbCmd.Execute
if not rsScheduledReports.EOF then
...
Each time when the code is executed to this line, an error is generated :
ADODB.Recordset: Operation is not allowed when the object is closed
This is strange as there are actually many records come from the database and this is proved by executing the sql in Management Studio mannually.
The VBScript code worked on SQL Server 2000, recently we upgraded to version 2005 then it breaks.
I spent a lot of time googling on the Internet and finally a trick fixed it. Just add this line to the beginning of the stored procedure: SET NOCOUNT ON.
This makes me thinking what's difference between SQL Server 2000 and 2005 version when adding set nocount on statement in a stored procedure. The behaviour must have changed for new version.
dim conn
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionTimeout = connTimeOut
conn.CommandTimeout = connCmdTimeOut
conn.Open connString
dim dbCmd
set dbCmd = CreateObject("ADODB.Command")
dbCmd.CommandTimeout = 300
dbCmd.CommandType = adCmdText
dbCmd.ActiveConnection = Conn
sqlText = "ReportScheduler '" & currentDate & "' "
dbCmd.CommandText = sqlText
dim rsScheduledReports
set GetScheduledReports = dbCmd.Execute
if not rsScheduledReports.EOF then
...
Each time when the code is executed to this line, an error is generated :
ADODB.Recordset: Operation is not allowed when the object is closed
This is strange as there are actually many records come from the database and this is proved by executing the sql in Management Studio mannually.
The VBScript code worked on SQL Server 2000, recently we upgraded to version 2005 then it breaks.
I spent a lot of time googling on the Internet and finally a trick fixed it. Just add this line to the beginning of the stored procedure: SET NOCOUNT ON.
This makes me thinking what's difference between SQL Server 2000 and 2005 version when adding set nocount on statement in a stored procedure. The behaviour must have changed for new version.
Tuesday, 4 November 2008
Use FMTONLY To Obtain an Query or stored procedure metadata
When executing a t-sql or stored procedure, if set FMTONLY value to ON, an zero-row resultset is produced with metadata information. The full query is not run. This feature is used for many report designers like Crystal Report and Reporting Service.
For example:
SET FMTONLY ON
select * from dbo.Items
SET FMTONLY OFF
The result is an empty row with column names and column data types.
For example:
SET FMTONLY ON
select * from dbo.Items
SET FMTONLY OFF
The result is an empty row with column names and column data types.
Wednesday, 3 September 2008
Declare a local variable in T-Sql while loop
I have had some trouble to find a bug inside a sql server stored procedure.
I have a while loop in the stored procedure like this:
While Exists(…)
Begin
Declare @CategoryID int
// here I assign the value to @CategoryID with a CategoryID field by joining Category and Product tables, the join could return one record or no record with some where clause.
// then check value @CategoryID by printing it
// do something to make the while loop end
End
There is no problem with while loop itself, it ends as expected. The problem is the value of @CategoryID variable. I assume each time I declare the variable in the loop, a null value is assigned it by default. But the reality is not, if there is a value returned from the table join select, the value is assigned to the variable, this is how it should be. But if there is no value returned from the join, the value from the last loop is carried forward, instead of a null. This makes me thinking if the Declare command in a while loop only happen once and leave the variable available for the next loop.
I have a while loop in the stored procedure like this:
While Exists(…)
Begin
Declare @CategoryID int
// here I assign the value to @CategoryID with a CategoryID field by joining Category and Product tables, the join could return one record or no record with some where clause.
// then check value @CategoryID by printing it
// do something to make the while loop end
End
There is no problem with while loop itself, it ends as expected. The problem is the value of @CategoryID variable. I assume each time I declare the variable in the loop, a null value is assigned it by default. But the reality is not, if there is a value returned from the table join select, the value is assigned to the variable, this is how it should be. But if there is no value returned from the join, the value from the last loop is carried forward, instead of a null. This makes me thinking if the Declare command in a while loop only happen once and leave the variable available for the next loop.
Wednesday, 16 July 2008
Reporting Service security
I have a Reporting Service report which sits in a remote server. I need to display the report in a ReportViewer control in a dotnetnuke portal. The report was displayed fine when I test in a stand alone web page, but when I deploy the user control in the DNN portal, I got the following security message:
The permissions granted to user 'BIOLAB\AD_ALANZ$' are insufficient for performing this operation. (rsAccessDenied)
It turns out the account used in my local computer doesn't have enough permission to view the report.
I did a search through web and solved by the following steps:
Go to the report manager home page. Click on Properties tab.
Click on New Role Assignment button.
Add a new user BIOLAB\AD_ALANZ$, choose Browser role from the list and click Apply.
Then my report is showing in the ReportViewer successfully.
The permissions granted to user 'BIOLAB\AD_ALANZ$' are insufficient for performing this operation. (rsAccessDenied)
It turns out the account used in my local computer doesn't have enough permission to view the report.
I did a search through web and solved by the following steps:
Go to the report manager home page. Click on Properties tab.
Click on New Role Assignment button.
Add a new user BIOLAB\AD_ALANZ$, choose Browser role from the list and click Apply.
Then my report is showing in the ReportViewer successfully.
Subscribe to:
Posts (Atom)