This gave me a good headache !
Do you see anything wrong here in this Elements.xml...
Here is the corresponding log :
In fact the problem has nothing to do with SQL:
SharePoint will for a very (dark) mystical reason try to parse the comments, remove the comments from the Elements.xml and it works (again) :) Thanks to Bjørn Furuknap for his post.
Do you see anything wrong here in this Elements.xml...
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Receivers ListTemplateId="15008"> <Receiver> <Name>ExampleAItemAdding</Name> <Type>ItemAdding</Type> <SequenceNumber>10000</SequenceNumber> <Assembly>DemoA.EventHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2b7e66595434a588</Assembly> <Class>DemoA.EventHandlers.ExampleA</Class> </Receiver> <!--<Receiver> <Name>ExampleAItemDeleting</Name> <Type>ItemDeleting</Type> <SequenceNumber>10000</SequenceNumber> <Assembly>DemoA.EventHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2b7e66595434a588</Assembly> <Class>DemoA.EventHandlers.ExampleA</Class> </Receiver>--> </Receivers> <Receivers ListTemplateId="15010"> <Receiver> <Name>ExampleBItemAdding</Name> <Type>ItemAdding</Type> <SequenceNumber>10000</SequenceNumber> <Assembly>DemoB.EventHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2b7e66595434a588</Assembly> <Class>DemoB.EventHandlers.ExampleB</Class> </Receiver> <Receiver> <Name>ExampleBItemDeleting</Name> <Type>ItemDeleting</Type> <SequenceNumber>10000</SequenceNumber> <Assembly>DemoB.EventHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2b7e66595434a588</Assembly> <Class>DemoB.EventHandlers.ExampleB</Class> </Receiver> </Receivers> </Elements>...that would explain this error message on feature activation?
Cannot insert the value NULL into column 'Name', table 'WSS_Content.dbo.EventReceivers'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command) at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionContentTypeAndEventReceiverBindings(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce) at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce) at Microsoft.SharePoint.SPFeature.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce) at Microsoft.SharePoint.SPFeatureCollection.AddInternal(Guid featureId, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly) at Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId) at Microsoft.SharePoint.WebControls.FeatureActivator.BtnActivateFeature_Click(Object objSender, EventArgs evtargs) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Here is the corresponding log :
System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Name', table 'WSS_Content.dbo.EventReceivers'; column does not allow nulls. INSERT fails. The statement has been terminated.My first reaction: "£§#%& SQL exception ???"
In fact the problem has nothing to do with SQL:
SharePoint will for a very (dark) mystical reason try to parse the comments, remove the comments from the Elements.xml and it works (again) :) Thanks to Bjørn Furuknap for his post.
Comments