Bonjour

J'ai une page en ASP.NET avec Visual Studio 2012 que je teste en local. Celle-ci fonctionne parfaitement bien. Par contre, dès que je publie mon projet sur le serveur Windows 2012 j'obtiens cette erreur :

Incorrect syntax near the keyword 'and'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'and'.

Source Error:


Line 1192: mySqlCommand.Parameters.Add(parm_select_vs)
Line 1193: MyConnection.Open()
Line 1194: mySqlCommand.ExecuteScalar()
Line 1195:
Line 1196:

Source File: D:\inetpub-uni-intranet\gestion\Formulaire.aspx.vb Line: 1194

Stack Trace:


[SqlException (0x80131904): Incorrect syntax near the keyword 'and'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +2440374
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5765244
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +285
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4169
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +58
System.Data.SqlClient.SqlDataReader.get_MetaData() +89
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) +409
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +2127
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +911
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +64
System.Data.SqlClient.SqlCommand.ExecuteScalar() +271
Formulaire_AnaVente_B2.MAJCrystalViewer() in D:\inetpub-uni-intranet\gestion\Formulaire.aspx.vb:1194
Formulaire_AnaVente_B2.Page_Load(Object sender, EventArgs e) in D:\inetpub-uni-intranet\gestion\Formulaire.aspx.vb:254
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678

Line 1194: mySqlCommand.ExecuteScalar() exécute une procédure stockée avec le paramètre parm_select_vs (qui contient un SELECT etc...)

Je ne comprends pas si l'erreur Incorrect syntax near the keyword 'and'. vient d'une erreur dans le SELECT pour l'exécution de la procédure stockée, ou dans la procédure stockée en elle-même ?

Pourquoi cela marche en local et plus sur le serveur ?

Merci par avance et meilleures salutations