2009-09-12 6 views
14

के पास गलत वाक्यविन्यास कृपया कोई मेरी मदद करें! मेरे पास एसक्यूएल सर्वर 2005 के साथ विंडोज 2003 पर एक ऐप चल रहा है। जब मैं इसे किसी अन्य ऐप पर अन्य ऐप पर तैनात करने का प्रयास करता हूं Windows 2003 SQL Server 2000 के साथ, अनुप्रयोग के कुछ पृष्ठों bellow संदेश दिखाता है:एसक्यूएलएक्सप्शन (0x80131904): रेखा 28: '('।]

Server Error in '/' Application. 
Line 1: Incorrect syntax near '('. 
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: Line 1: Incorrect syntax near '('. 

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 


Stack Trace: 

[SqlException (0x80131904): Line 1: Incorrect syntax near '('.] 
    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826 
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747 
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 
    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392 
    System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33 
    System.Data.SqlClient.SqlDataReader.get_MetaData() +83 
    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297 
    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954 
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162 
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 
    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141 
    System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12 
    System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10 
    System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +383 

[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.] 
    System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +422 
    System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +745 
    System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +162 
    System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +45 
    System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +203 
    System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1(IEnumerable`1 sequence) +40 
    System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle(IEnumerable`1 query, Expression queryRoot) +60 
    System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +109 
    System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +269 
    SebraeFE.Models.Repositories.InterestsRepository.DeleteInterests(Interests interestsToDelete) +418 
    SebraeFE.Models.Managers.InterestsManager.DeleteInterests(Interests interestsToDelete) +41 
    SebraeFE.Models.Facades.InterestsFacade.DeleteInterests(Interests interestsToDelete) +41 
    SebraeFE.Controllers.OportunidadeController.ApagarInteresse(Int32 Id) +265 
    lambda_method(ExecutionScope , ControllerBase , Object[]) +78 
    System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24 
    System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() +53 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258 
    System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9() +20 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258 
    System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9() +20 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +193 
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +382 
    System.Web.Mvc.Controller.ExecuteCore() +123 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23 
    System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 
    System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +144 
    System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +54 
    System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +406 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76 


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 

एक tecnologies unsing bellow:

  • asp.net MVC के 1

  • एडीओनेट और LINQ

कृपया मेरी मदद करें!

+7

यह एक वास्तविक क्वेरी के बिना इस समस्या निवारण के लिए बहुत मुश्किल हो जा रहा है था । –

+1

स्टैकट्रैक –

+0

की बजाय स्टैक ट्रेस को देखने से आपकी क्वेरी चिपकाने का प्रयास करें मुझे लगता है कि यह एमवीसी और एसक्यूएल 2000 – BlackTigerX

उत्तर

0

ऐसा लगता है कि आप कुछ ऐसा करने का प्रयास कर रहे हैं जो SQL 2005 है और SQL 2000 नहीं है। सामान्य टेबल अभिव्यक्तियाँ?

1

आपकी क्वेरी की तरह दिखने के बारे में एक विचार है कि यह काफी मुश्किल है। इस विशेष अपवाद ने मुझे पहले शीर्ष अभिव्यक्तियों के साथ मिल गया है। एसक्यूएल 2005+ में एक सरल चयन टॉप ऐसा दिखाई दे सकता:

SELECT TOP (50) FROM Events 

क्योंकि एसक्यूएल 2000 का चयन टॉप अभिव्यक्ति में कोष्ठक की अनुमति नहीं है लेकिन अगर आप आप एसक्यूएल 2000 में की बात कर रहे हैं सटीक सिंटैक्स त्रुटि अपवाद प्राप्त होगा। दूसरे शब्दों में यह इस तरह दिखेगा की जरूरत है:

SELECT TOP 50 FROM Events 

एक और टिप कोशिश करते हैं और इस की तह तक पहुंचने के लिए सटीक एसक्यूएल विवरण जनरेट करने के लिए तो एसक्यूएल 2000 एंटरप्राइज़ प्रबंधक में जाने और इसे चलाने के लिए है। जब यह आपको कुछ मामलों में एक ही त्रुटि देता है तो ईएम आपको सिंटैक्स समस्या कहां मौजूद है, इसके बारे में थोड़ा करीब बताएगा (

2

कुछ SQL सर्वर 2005 प्रश्न जिनमें 2005-विशिष्ट एक्सटेंशन शामिल हैं ROW_NUMBER(), सामान्य तालिका अभिव्यक्ति [उदाहरण के लिए एक्स के साथ (...) का चयन करें ... एक्स से], आदि SQL सर्वर के साथ पीछे की ओर संगत 2000

आप यह सुनिश्चित करना चाहिए या तो है कि आपके आवेदन केवल SQL सर्वर 2005 पर चलता है या आप अपने प्रश्नों rework चाहिए नहीं कर रहे हैं जो एसक्यूएल सर्वर 2005 के लिए SQL Server 2000, 2005 और संभवतः 2008 को भी अच्छे उपाय के लिए समर्थन देने के लिए विशिष्ट हैं। एसक्यूएल सर्वर के विभिन्न संस्करणों के बीच टी-एसक्यूएल सिंटैक्स और अर्थशास्त्र में अंतर क्या है, इस बारे में बहुत सारे दस्तावेज उपलब्ध हैं।

मुझे डर है कि आपको वास्तविक क्वेरी टेक्स्ट को प्रकट किए बिना किसी से भी अधिक विशिष्ट सहायता प्राप्त नहीं होगी। यह मेरे जैसा होगा कि आप मेरी तीसरी साल के अंग्रेजी टर्म पेपर की लाइन 12 पर अपनी वर्तनी त्रुटि को सही करने के लिए कहें। नहीं, आपके पास यह नहीं हो सकता है, लेकिन क्या आप इसे मेरे लिए प्रमाणित कर सकते हैं?

0

मुझे वास्तविक कारण नहीं मिला। लेकिन यह linq और sql2000 के बारे में कुछ प्रतीत होता है, ठीक उसी तरह चार्ल्स Conway ने कहा।

नीचे कोड मेरे लिए काम करता है:

बदल देते हैं:

//... 
    Interests original = (from m in _db.InterestsSet where m.Id == interestsToDelete.Id select m).FirstOrDefault(); 
//... 

रहे हैं:

//.. 
     Interests original = null; 

     foreach (var i in from m in _db.InterestsSet where m.Id == interestsToDelete.Id select m){ 
      original = i; 
      break; 
     } 
    //... 

मुझे यह पसंद नहीं है, लेकिन काम करता है ...

5

में .edmx फ़ाइल जिसे आपको ProviderManifestToken को 2000 में स्कीमा टैग में ProviderManifestToken = "2000" में बदलने की आवश्यकता है (यह वाईआई ProviderManifestToken हो जाएगा = "2005")

रेफरी: Entity Framework on Sql 2000 vs. Sql 2005 and ProviderManifestToken

24

एक्सएमएल संपादक के साथ अपने मॉडल .edmx खोलें, और संशोधित करें इस

ProviderManifestToken="2008" 

को

ProviderManifestToken="2000" 

यह हो सकता है linq .first() जो एसक्यूएल स्क्रिप्ट 'टॉप (1)' उत्पन्न करता है जो एसक्यूएल 2005 में काम करता है, लेकिन एसक्यूएल 2000

में आउट '(' और ')' के साथ 'टॉप 1' होना चाहिए

यह मेरे समाधान में काम करता है।

+0

के साथ एक संगतता समस्या हो सकती है, edmx फ़ाइल नहीं होनी चाहिए। अगर मैं कर सकता तो मैं इसे संपादित कर दूंगा ... –

+0

मेरी इच्छा है कि मैं पहले यहां देखूंगा, धन्यवाद +1 – Jodrell

+0

मुझे एक ही समस्या है लेकिन यह '-' के पास गलत वाक्यविन्यास देता है। "गलत वाक्यविन्यास के पास '('।" के बजाय मैं क्या करूंगा –

1

यह त्रुटि सिर्फ नेट ढांचे पर चल रहा है 4.

यह वास्तव में सरल, डबल अपनी क्वेरी जांचें था LINQ में सुरक्षित टाइप है Windows सेवा में एसक्यूएल सर्वर 2008 के साथ इकाई की रूपरेखा का उपयोग कर मुझे क्या हुआ। यदि fldvarchar है, तो आपको fld isnot nothing कहां करना चाहिए, जहां आईई fld > 0 जैसे क्लॉज नहीं करता है। समस्या मुझे लगता है कि जब .net linq प्रकारों को डीबी फ़ील्ड प्रकारों से मिलान करने का प्रयास करता है और SQL सर्वर जेनरेट किए गए SQL को चलाने को पसंद नहीं करता है।

तो मूल रूप से यह त्रुटि एक पिकनिक है जो सॉफ़्टवेयर गड़बड़ नहीं है।

मेरे क्वेरी कि सूचक चला गया

qry = qry.Where(Function(rslts) (rslts.SubscriptionEndDate <= DeadLine _ 
     And rslts.SubscriptionCancelledByName > 0 _ 
     And rslts.SubscriptionIsRenewalEmailSent = False)) 

क्वेरी कि हल समस्या

qry = qry.Where(Function(rslts) (rslts.SubscriptionEndDate <= DeadLine _ 
     And rslts.SubscriptionCancelledByName IsNot Nothing _ 
     And rslts.SubscriptionIsRenewalEmailSent = False)) 

आशा इस मदद करता है

संबंधित मुद्दे