Setting the mapping property in the SQL Server 2005 connection string

I have an ASP.Net web application with a connection string for SQL Server 2005 in the web.config file.

Data Source=ABCSERVER;Network Library=DBMSSOCN;Initial Catalog=myDataBase; User ID=myUsername;Password=myPassword; 

I want to specify a mapping property in web.config for different languages ​​like French, for example

  Data Source=ABCSERVER;Network Library=DBMSSOCN;Initial Catalog=myDataBase; User ID=myUsername;Password=myPassword;Collation=French_CS_AS 

But the word Collation is not valid in the connection string.

What is the correct keyword to use to specify sorting in the SQL Server 2005 connection string?

EDIT * I understand that sorting can be set during the installation of the database and can also be changed. I do not want to constantly change it in the database. But I want SQLClient to establish a mapping based on application parameters. I want to use it only when using SQL Query, for example, "SELECT * FROM TESTTABLE ORDER BY TESTCOLUMN COLLATE French_CS_AS". I am trying to ensure that for a given connection, all commands / requests for this connection would automatically use "French_CS_AS" based on the property parameter in the connection string, instead of changing the request definitions *

+4
source share
1 answer

You cannot establish a mapping for the connection. It is simply not supported. See SQL Server Native Client: Connection Strings and OLE DB for a really interesting blog article on how connection strings are parsed.

You can set the language to connect. The language setting for the connection changes how dates are processed and leads to system error messages in the specified language. For more information on setting the language, see Session Language .

Warning about using mappings for non-Unicode types from COLLATE (Transact-SQL) :

Codepage translations are supported for char and varchar data types, but not for text data. Data loss during code page translation is not reported.

Ideally, if you need ongoing multilingual support from your data, you should use Unicode data types (nvarchar, etc.). You can also see an article and international terminology on MSDN for more information about this. It contains links to some additional articles, which are very useful, so do not stop there.

+2
source

Source: https://habr.com/ru/post/1313113/


All Articles