SqlException (0x80131904): Строка 28: Неправильный синтаксис рядом' ('].

Ваш компилятор может иметь предупреждение, что он может генерировать, если функция базового класса становится скрытой. Если это делает, включите его. Это поймает столкновения константы и различия в списках параметров. К сожалению, это не раскроет орфографическую ошибку.

, Например, это предупреждает C4263 в Microsoft Visual C++.

14
задан OMG Ponies 12 September 2009 в 00:49
поделиться

6 ответов

Some SQL Server 2005 queries which contain 2005-specific extensions like ROW_NUMBER(), common table expressions [e.g. WITH x AS (...) SELECT ... FROM x], etc. are not backwards compatible with SQL Server 2000.

You must either ensure that your application runs only on SQL Server 2005 or you must rework your queries that are specific to SQL Server 2005 to support SQL Server 2000, 2005, and probably 2008 too for good measure. There is plenty of documentation available as to what the differences are in T-SQL syntax and semantics among the different versions of SQL Server.

I'm afraid you're not going to get much more specific help from anyone without revealing the actual query text. That would be like me asking you to correct my spelling error on line 12 of my 3rd year English term paper. No, you can't have it, but can you proofread it for me?

2
ответ дан 1 December 2019 в 08:17
поделиться

It is quite difficult w/o having an idea of what your query looks like. This particular exception has got me before with SELECT TOP expressions. In SQL 2005+ a simple SELECT TOP could look like this:

SELECT TOP (50) FROM Events

However you will receive the exact syntax error exception you are speaking of in SQL 2000 because SQL 2000 doesn't allow parenthesis in the SELECT TOP expression. In other words it needs to look like this:

SELECT TOP 50 FROM Events

Another tip to try and get to the bottom of this is to get the exact SQL statement generated, then go into SQL 2000 Enterprise Manager and run it. When it gives you the same error in some cases EM will point you a little closer as to where the syntax issue exists (try splitting your query up on multiple lines)

1
ответ дан 1 December 2019 в 08:17
поделиться

It sounds quite possible you're trying to use something that SQL 2005 has and SQL 2000 doesn't. Common table expressions?

0
ответ дан 1 December 2019 в 08:17
поделиться

Я не нашел настоящей причины. Но, похоже, что-то связано с linq и sql2000, в точности как сказал Чарльз Конвей.

Приведенный ниже код работает для меня:

заменить:

//...
    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;
        }
    //...

Мне это не нравится, но работает ...

0
ответ дан 1 December 2019 в 08:17
поделиться

It could be LINQ. It's not 100% compatible with Sql 2000.

0
ответ дан 1 December 2019 в 08:17
поделиться

В файле .edmx вам нужно изменить ProviderManifestToken на 2000 в теге схемы на ProviderManifestToken = "2000" (это будет ProviderManifestToken = "2005" )

ref: Entity Framework на Sql 2000 по сравнению с Sql 2005 и ProviderManifestToken

5
ответ дан 1 December 2019 в 08:17
поделиться
Другие вопросы по тегам:

Похожие вопросы: