Application vs database language

Discussion in 'Databases' started by MikeDelp, Apr 11, 2013.

  1. Hi all,
    today I have started deploying my ASP.NET application which uses 2 SQL Server databases (the Membership one and the user data one).

    As Winhost servers use "en-US" culture, in order to expose the date values from the DB according to Italian way (DD/MM/YYYY), I have added to web.config file the following line:

    <globalization culture="it-IT" uiCulture="it-IT" />

    It works fine as regards date exposing, but I have troubles due to the fact that the default language of the database is English. More in detail, troubles are when in my code-behind I add datetime parameters to a stored procedure parsing it from a textbox which contains an Italian-fashioned date, for example:

    SqlDataSource1.SelectParameters.Add("dataNascita2", tb.Text);

    where tb is a TextBox control on my page.

    gets me an exception that says "Error converting data type nvarchar to date."

    Such statements work fine in my local development environment, where all is set to Italian culture.

    My question is: how can I set the database language to Italian? I have tried to change it in the login settings in SQL Management Studio, but it says I'm not authorized to change login settings.

    Any help?

    Thanks in advance :)
    Mike
     
    Last edited by a moderator: Oct 14, 2015
  2. Elshadriel

    Elshadriel Winhost Staff

    Last edited by a moderator: Oct 14, 2015
  3. Hi Elshadriel,

    thanks for your suggestion. But there is an additional issue now. When I try to execute the command

    ALTER DATABASE DB_57413_mrdemo COLLATE Latin1_General_CI_AS

    SQL Server gives me this error message:

    "Msg 5075, Level 16, State 1, Line 2
    The object 'CK_Clienti' is dependent on database collation. The database collation cannot be changed if a schema-bound object depends on it. Remove the dependencies on the database collation and then retry the operation.
    Msg 5072, Level 16, State 1, Line 2
    ALTER DATABASE failed. The default collation of database 'DB_57413_mrdemo' cannot be set to Latin1_General_CI_AS."

    Notice that it would be no problem if I have to re-create my database from scratch. If you can tell me how to set the collation when creating the database maybe it will be ok.
     
  4. Elshadriel

    Elshadriel Winhost Staff

    You might want to review this link:

    http://social.msdn.microsoft.com/Fo.../thread/39321443-c2f9-4275-a571-1d3b1d52b51c/

     
  5. Thanks Elshadriel. I'll go in deep with this article.
     

Share This Page