Slam Issue on date

Mar 11, 2009 at 4:26 PM

Hello, I'm trying to use SLAM, but I have a problem. I have placed the slam.config in the root of my web application,

diagnostic and configuration are ok, but when I push the activation button, I receive the following error:

Logging error: insert into SLAM.SLAMMessageLog select '11/03/2009 15.19.05', 'Information', 'Trace Level: Error'
System.Data.SqlClient.SqlException: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
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 System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
   at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.DataContext.ExecuteMethodCall(Object instance, MethodInfo methodInfo, Object[] parameters)
   at System.Data.Linq.DataContext.ExecuteCommand(String command, Object[] parameters)
   at AWS.SLAM.Data.SqlLogDataRepository.LogMessage(String tableSchema, String messageType, String message)   at AWS.SLAM.Data.SqlLogDataRepository.LogMessage(String tableSchema, String messageType, String message)
   at AWS.SLAM.Logging.SqlLogger..ctor(IConfigurationManager configuration)
   at AWSSLAMLoggingSqlLoggerInstanceBuilderc99cd72c7f9e47b883543e3ea58e35ff.BuildInstance(IConfiguredInstance , BuildSession )
   at StructureMap.Pipeline.ConfiguredInstanceBase`1.StructureMap.Pipeline.IConfiguredInstance.Build(Type pluginType, BuildSession session, InstanceBuilder builder)

The error lies in date format, because is in italian (d/m/Y H.i.s instead m/d/Y H:i:s), so SLAM can't insert the log

into the DB.

Any clue?
Thank you

Developer
Mar 11, 2009 at 7:50 PM
It does seem to be a localization issue, but the date time format looks correct.  In the Exception it actually shows you what command it is trying to execute, which is: insert into SLAM.SLAMMessageLog select '11/03/2009 15.19.05', 'Information', 'Trace Level: Error'

The date then is "11/03/2009 15.19.05" which looks like correct.  But because you are getting that error anyway I assume that the server with SharePoint is use its current culture to provide the date in the correct format but then your SQL Server is not localized properly.  SQL Server is trying to perform an implicit conversion of the string into a datetime but it doesn't match the expected format because of the periods.  11/03/2009 is a valid date part even if it were m/d/Y instead of d/m/Y, but the periods instead of colons would cause it to fail if the conversion is looking for colons.  I would think your SQL Server would also expect the Italian date format, but the reason you are getting that error is probably because it's using the "m/d/Y H:i:s" format.
May 11, 2009 at 5:58 PM

I'm having a similar problem. Althought it's everything ok when I click on activate, i'm having an issue in synchronization.

I have a date field in SP that shows the date in the portuguese date format (DD-MM-YYYY).

When I do the synchronization, it places the date in the format MM-DD-YYYY.

My SLAM's DB collation is the portuguese collation (SQL_Latin1_General_CP850_CI_AI).

Do I have to do any extra configuration?

 

Thanks for the help!

 

Oct 28, 2009 at 5:43 AM

Hello, I am having the same issue while going to sync.

My sql server having dutch culture and have separate ',' instead of '.' for numeric field.

Now, I wann to convert the currency type column into sharepoint.But its giving me error (incorrnect syntax near '5' ).

I am able to run the same SLAM.config file at local server which containing english(default) culture.

DO i need to do any change under slam.config file or how to migrate this custom list data into SLAM db?

Please help me out. THanks

 

Developer
Oct 28, 2009 at 4:42 PM

shah,

So I understand what is going on: you have a currency column in SharePoint, you have it configured to be slammed in your slam.config, and you have set the SqlType to decimal, etc, and the SQL statement that SLAM is using to insert has that numeric value, from SharePoint with a "." ?  SLAM is just getting the value from SharePoint, and I would presume that your SharePoint instance is also configured to stored values in the Dutch format?  So if I call .ToString on your currency column in SharePoint, would I get back say "11,20" instead of "11.20"?  If SharePoint is returning the appropriate symbol, then the SQL statement is going to include a value with a comma in the middle of it, which I realize SLAM will render among other columns and the value would probably be treated as two columns.  When you write a select statement when SQL is set to a culture where a comma is the decimal symbol that just contains a value, do you surround with it brackets?  So in that situation SLAM would have something like "insert into [table] select 11.20".  Would you write the equivalent statement as "insert into [table] select [11,20]" ?