C# entity framework Querying stored procedure error “Culture is not supported”
Im trying to query data from a database which contains some korean text. The same works with other DB which doesnt have any korean information. Should i set some culture info? The DB collation i found is Korean_Wansung_Unicode_CI_AS
using (DBModel data = new DBModel())
//command and parameters prepared here
var SqlCommand = "ProcedureName @LastUpdateDate, @LastUpdateTS";
var SqlParams = new SqlParameter
new SqlParameter ParameterName = "@LastUpdateDate", Value =lastDatetime, Direction = System.Data.ParameterDirection.Input ,
new SqlParameter ParameterName = "@LastUpdateTS", Value =lastTS, Direction = System.Data.ParameterDirection.Input
;
return data.Database.SqlQuery<BP>(SqlCommand, SqlParams).ToList();
This Database.SqlQuery is throwing CultureNotFoundException as below
Culture is not supported.
Parameter name: culture
66578 (0x10412) is an invalid culture identifier.
at System.Globalization.CultureInfo.GetCultureInfo(Int32 culture)
at System.Globalization.CompareInfo.GetCompareInfo(Int32 culture)
at System.Data.ProviderBase.FieldNameLookup.LinearIndexOf(String fieldName, CompareOptions compareOptions)
at System.Data.ProviderBase.FieldNameLookup.IndexOf(String fieldName)
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.TryGetColumnOrdinalFromReader(DbDataReader storeDataReader, String columnName, Int32& ordinal)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.CreateColumnMapFromReaderAndClrType(DbDataReader reader, Type type, MetadataWorkspace workspace)
at System.Data.Entity.Core.Objects.ObjectContext.InternalTranslate[TElement](DbDataReader reader, String entitySetName, MergeOption mergeOption, Boolean streaming, EntitySet& entitySet, TypeUsage& edmType)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryInternal[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__68()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__67()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryReliably[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQuery[TElement](String commandText, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Internal.InternalContext.<>c__DisplayClass14`1.<ExecuteSqlQuery>b__13()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
I tried the same with the plain old way to retrive the data to a datatable, somehow it works. So what need to be set in EF?
var SqlCommand = "exec ProcedureName '2018-11-11 16:30:00', 163000";
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString();
SqlConnection con = new System.Data.SqlClient.SqlConnection(constring);
SqlCommand cmd = new SqlCommand(SqlCommand, con);
cmd.CommandType = System.Data.CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
c# entity-framework
|
show 3 more comments
Im trying to query data from a database which contains some korean text. The same works with other DB which doesnt have any korean information. Should i set some culture info? The DB collation i found is Korean_Wansung_Unicode_CI_AS
using (DBModel data = new DBModel())
//command and parameters prepared here
var SqlCommand = "ProcedureName @LastUpdateDate, @LastUpdateTS";
var SqlParams = new SqlParameter
new SqlParameter ParameterName = "@LastUpdateDate", Value =lastDatetime, Direction = System.Data.ParameterDirection.Input ,
new SqlParameter ParameterName = "@LastUpdateTS", Value =lastTS, Direction = System.Data.ParameterDirection.Input
;
return data.Database.SqlQuery<BP>(SqlCommand, SqlParams).ToList();
This Database.SqlQuery is throwing CultureNotFoundException as below
Culture is not supported.
Parameter name: culture
66578 (0x10412) is an invalid culture identifier.
at System.Globalization.CultureInfo.GetCultureInfo(Int32 culture)
at System.Globalization.CompareInfo.GetCompareInfo(Int32 culture)
at System.Data.ProviderBase.FieldNameLookup.LinearIndexOf(String fieldName, CompareOptions compareOptions)
at System.Data.ProviderBase.FieldNameLookup.IndexOf(String fieldName)
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.TryGetColumnOrdinalFromReader(DbDataReader storeDataReader, String columnName, Int32& ordinal)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.CreateColumnMapFromReaderAndClrType(DbDataReader reader, Type type, MetadataWorkspace workspace)
at System.Data.Entity.Core.Objects.ObjectContext.InternalTranslate[TElement](DbDataReader reader, String entitySetName, MergeOption mergeOption, Boolean streaming, EntitySet& entitySet, TypeUsage& edmType)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryInternal[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__68()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__67()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryReliably[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQuery[TElement](String commandText, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Internal.InternalContext.<>c__DisplayClass14`1.<ExecuteSqlQuery>b__13()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
I tried the same with the plain old way to retrive the data to a datatable, somehow it works. So what need to be set in EF?
var SqlCommand = "exec ProcedureName '2018-11-11 16:30:00', 163000";
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString();
SqlConnection con = new System.Data.SqlClient.SqlConnection(constring);
SqlCommand cmd = new SqlCommand(SqlCommand, con);
cmd.CommandType = System.Data.CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
c# entity-framework
It may because the stored procedure may be requiring 'Culture' parameter but you are not providing it.
– yogihosting
Nov 13 '18 at 9:23
no, there is no such parameter.
– Hybridzz
Nov 13 '18 at 9:24
ok please provide full code for the comments section '//command and parameters prepared here' and also the stored procedure which you have (if any)
– yogihosting
Nov 13 '18 at 9:26
I have edited the question
– Hybridzz
Nov 13 '18 at 9:32
1
the only code-path I can find that doesn't pass -1 isSqlClient.SqlDataReader.GetOrdinal, which passes_defaultLCID; this comes from the_parser.DefaultLCID- which looks like it comes from the TDS stream (an "env" change, type 5); so indeed, my initial thought is that: SqlClient (not specifically EF) hates your SQL Server's collation!
– Marc Gravell♦
Nov 13 '18 at 9:40
|
show 3 more comments
Im trying to query data from a database which contains some korean text. The same works with other DB which doesnt have any korean information. Should i set some culture info? The DB collation i found is Korean_Wansung_Unicode_CI_AS
using (DBModel data = new DBModel())
//command and parameters prepared here
var SqlCommand = "ProcedureName @LastUpdateDate, @LastUpdateTS";
var SqlParams = new SqlParameter
new SqlParameter ParameterName = "@LastUpdateDate", Value =lastDatetime, Direction = System.Data.ParameterDirection.Input ,
new SqlParameter ParameterName = "@LastUpdateTS", Value =lastTS, Direction = System.Data.ParameterDirection.Input
;
return data.Database.SqlQuery<BP>(SqlCommand, SqlParams).ToList();
This Database.SqlQuery is throwing CultureNotFoundException as below
Culture is not supported.
Parameter name: culture
66578 (0x10412) is an invalid culture identifier.
at System.Globalization.CultureInfo.GetCultureInfo(Int32 culture)
at System.Globalization.CompareInfo.GetCompareInfo(Int32 culture)
at System.Data.ProviderBase.FieldNameLookup.LinearIndexOf(String fieldName, CompareOptions compareOptions)
at System.Data.ProviderBase.FieldNameLookup.IndexOf(String fieldName)
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.TryGetColumnOrdinalFromReader(DbDataReader storeDataReader, String columnName, Int32& ordinal)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.CreateColumnMapFromReaderAndClrType(DbDataReader reader, Type type, MetadataWorkspace workspace)
at System.Data.Entity.Core.Objects.ObjectContext.InternalTranslate[TElement](DbDataReader reader, String entitySetName, MergeOption mergeOption, Boolean streaming, EntitySet& entitySet, TypeUsage& edmType)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryInternal[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__68()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__67()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryReliably[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQuery[TElement](String commandText, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Internal.InternalContext.<>c__DisplayClass14`1.<ExecuteSqlQuery>b__13()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
I tried the same with the plain old way to retrive the data to a datatable, somehow it works. So what need to be set in EF?
var SqlCommand = "exec ProcedureName '2018-11-11 16:30:00', 163000";
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString();
SqlConnection con = new System.Data.SqlClient.SqlConnection(constring);
SqlCommand cmd = new SqlCommand(SqlCommand, con);
cmd.CommandType = System.Data.CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
c# entity-framework
Im trying to query data from a database which contains some korean text. The same works with other DB which doesnt have any korean information. Should i set some culture info? The DB collation i found is Korean_Wansung_Unicode_CI_AS
using (DBModel data = new DBModel())
//command and parameters prepared here
var SqlCommand = "ProcedureName @LastUpdateDate, @LastUpdateTS";
var SqlParams = new SqlParameter
new SqlParameter ParameterName = "@LastUpdateDate", Value =lastDatetime, Direction = System.Data.ParameterDirection.Input ,
new SqlParameter ParameterName = "@LastUpdateTS", Value =lastTS, Direction = System.Data.ParameterDirection.Input
;
return data.Database.SqlQuery<BP>(SqlCommand, SqlParams).ToList();
This Database.SqlQuery is throwing CultureNotFoundException as below
Culture is not supported.
Parameter name: culture
66578 (0x10412) is an invalid culture identifier.
at System.Globalization.CultureInfo.GetCultureInfo(Int32 culture)
at System.Globalization.CompareInfo.GetCompareInfo(Int32 culture)
at System.Data.ProviderBase.FieldNameLookup.LinearIndexOf(String fieldName, CompareOptions compareOptions)
at System.Data.ProviderBase.FieldNameLookup.IndexOf(String fieldName)
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.TryGetColumnOrdinalFromReader(DbDataReader storeDataReader, String columnName, Int32& ordinal)
at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.CreateColumnMapFromReaderAndClrType(DbDataReader reader, Type type, MetadataWorkspace workspace)
at System.Data.Entity.Core.Objects.ObjectContext.InternalTranslate[TElement](DbDataReader reader, String entitySetName, MergeOption mergeOption, Boolean streaming, EntitySet& entitySet, TypeUsage& edmType)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryInternal[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__68()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass69`1.<ExecuteStoreQueryReliably>b__67()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryReliably[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQuery[TElement](String commandText, ExecutionOptions executionOptions, Object parameters)
at System.Data.Entity.Internal.InternalContext.<>c__DisplayClass14`1.<ExecuteSqlQuery>b__13()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
I tried the same with the plain old way to retrive the data to a datatable, somehow it works. So what need to be set in EF?
var SqlCommand = "exec ProcedureName '2018-11-11 16:30:00', 163000";
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["Connection"].ToString();
SqlConnection con = new System.Data.SqlClient.SqlConnection(constring);
SqlCommand cmd = new SqlCommand(SqlCommand, con);
cmd.CommandType = System.Data.CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
c# entity-framework
c# entity-framework
edited Nov 13 '18 at 10:31
Hybridzz
asked Nov 13 '18 at 9:20
HybridzzHybridzz
1,38211119
1,38211119
It may because the stored procedure may be requiring 'Culture' parameter but you are not providing it.
– yogihosting
Nov 13 '18 at 9:23
no, there is no such parameter.
– Hybridzz
Nov 13 '18 at 9:24
ok please provide full code for the comments section '//command and parameters prepared here' and also the stored procedure which you have (if any)
– yogihosting
Nov 13 '18 at 9:26
I have edited the question
– Hybridzz
Nov 13 '18 at 9:32
1
the only code-path I can find that doesn't pass -1 isSqlClient.SqlDataReader.GetOrdinal, which passes_defaultLCID; this comes from the_parser.DefaultLCID- which looks like it comes from the TDS stream (an "env" change, type 5); so indeed, my initial thought is that: SqlClient (not specifically EF) hates your SQL Server's collation!
– Marc Gravell♦
Nov 13 '18 at 9:40
|
show 3 more comments
It may because the stored procedure may be requiring 'Culture' parameter but you are not providing it.
– yogihosting
Nov 13 '18 at 9:23
no, there is no such parameter.
– Hybridzz
Nov 13 '18 at 9:24
ok please provide full code for the comments section '//command and parameters prepared here' and also the stored procedure which you have (if any)
– yogihosting
Nov 13 '18 at 9:26
I have edited the question
– Hybridzz
Nov 13 '18 at 9:32
1
the only code-path I can find that doesn't pass -1 isSqlClient.SqlDataReader.GetOrdinal, which passes_defaultLCID; this comes from the_parser.DefaultLCID- which looks like it comes from the TDS stream (an "env" change, type 5); so indeed, my initial thought is that: SqlClient (not specifically EF) hates your SQL Server's collation!
– Marc Gravell♦
Nov 13 '18 at 9:40
It may because the stored procedure may be requiring 'Culture' parameter but you are not providing it.
– yogihosting
Nov 13 '18 at 9:23
It may because the stored procedure may be requiring 'Culture' parameter but you are not providing it.
– yogihosting
Nov 13 '18 at 9:23
no, there is no such parameter.
– Hybridzz
Nov 13 '18 at 9:24
no, there is no such parameter.
– Hybridzz
Nov 13 '18 at 9:24
ok please provide full code for the comments section '//command and parameters prepared here' and also the stored procedure which you have (if any)
– yogihosting
Nov 13 '18 at 9:26
ok please provide full code for the comments section '//command and parameters prepared here' and also the stored procedure which you have (if any)
– yogihosting
Nov 13 '18 at 9:26
I have edited the question
– Hybridzz
Nov 13 '18 at 9:32
I have edited the question
– Hybridzz
Nov 13 '18 at 9:32
1
1
the only code-path I can find that doesn't pass -1 is
SqlClient.SqlDataReader.GetOrdinal, which passes _defaultLCID; this comes from the _parser.DefaultLCID - which looks like it comes from the TDS stream (an "env" change, type 5); so indeed, my initial thought is that: SqlClient (not specifically EF) hates your SQL Server's collation!– Marc Gravell♦
Nov 13 '18 at 9:40
the only code-path I can find that doesn't pass -1 is
SqlClient.SqlDataReader.GetOrdinal, which passes _defaultLCID; this comes from the _parser.DefaultLCID - which looks like it comes from the TDS stream (an "env" change, type 5); so indeed, my initial thought is that: SqlClient (not specifically EF) hates your SQL Server's collation!– Marc Gravell♦
Nov 13 '18 at 9:40
|
show 3 more comments
1 Answer
1
active
oldest
votes
The LCID here appears to be set in the TDS parser - in particular TdsParser.TryProcessEnvChange; that means there isn't anything you can do in your C# code to change things.
All I can offer is two suggestions:
- try to install a relevant Korean language pack onto the machine that you're querying from; it could be that right now it is unable to resolve the culture, but that installing the language pack into Windows helps it understand - untested
- see if you can change the database collation; now obviously, this is a huge change that has massive impact, so shouldn't be done lightly - and ideally only after all other approaches have failed
The third option, of course, might be to see if the EF or SqlClient folks (overlapping teams) are responsive on github; they're under dotnet/corefx. The public github is mostly ".NET Core" however, so a great place to start would be to confirm that the same problem happens on .NET Core; if so, it'll be much easier to engage with people.
Disclaimer: everything here is from hacking through the call tree, and I do not make any claim to be authoritative on this.
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277604%2fc-sharp-entity-framework-querying-stored-procedure-error-culture-is-not-support%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The LCID here appears to be set in the TDS parser - in particular TdsParser.TryProcessEnvChange; that means there isn't anything you can do in your C# code to change things.
All I can offer is two suggestions:
- try to install a relevant Korean language pack onto the machine that you're querying from; it could be that right now it is unable to resolve the culture, but that installing the language pack into Windows helps it understand - untested
- see if you can change the database collation; now obviously, this is a huge change that has massive impact, so shouldn't be done lightly - and ideally only after all other approaches have failed
The third option, of course, might be to see if the EF or SqlClient folks (overlapping teams) are responsive on github; they're under dotnet/corefx. The public github is mostly ".NET Core" however, so a great place to start would be to confirm that the same problem happens on .NET Core; if so, it'll be much easier to engage with people.
Disclaimer: everything here is from hacking through the call tree, and I do not make any claim to be authoritative on this.
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
add a comment |
The LCID here appears to be set in the TDS parser - in particular TdsParser.TryProcessEnvChange; that means there isn't anything you can do in your C# code to change things.
All I can offer is two suggestions:
- try to install a relevant Korean language pack onto the machine that you're querying from; it could be that right now it is unable to resolve the culture, but that installing the language pack into Windows helps it understand - untested
- see if you can change the database collation; now obviously, this is a huge change that has massive impact, so shouldn't be done lightly - and ideally only after all other approaches have failed
The third option, of course, might be to see if the EF or SqlClient folks (overlapping teams) are responsive on github; they're under dotnet/corefx. The public github is mostly ".NET Core" however, so a great place to start would be to confirm that the same problem happens on .NET Core; if so, it'll be much easier to engage with people.
Disclaimer: everything here is from hacking through the call tree, and I do not make any claim to be authoritative on this.
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
add a comment |
The LCID here appears to be set in the TDS parser - in particular TdsParser.TryProcessEnvChange; that means there isn't anything you can do in your C# code to change things.
All I can offer is two suggestions:
- try to install a relevant Korean language pack onto the machine that you're querying from; it could be that right now it is unable to resolve the culture, but that installing the language pack into Windows helps it understand - untested
- see if you can change the database collation; now obviously, this is a huge change that has massive impact, so shouldn't be done lightly - and ideally only after all other approaches have failed
The third option, of course, might be to see if the EF or SqlClient folks (overlapping teams) are responsive on github; they're under dotnet/corefx. The public github is mostly ".NET Core" however, so a great place to start would be to confirm that the same problem happens on .NET Core; if so, it'll be much easier to engage with people.
Disclaimer: everything here is from hacking through the call tree, and I do not make any claim to be authoritative on this.
The LCID here appears to be set in the TDS parser - in particular TdsParser.TryProcessEnvChange; that means there isn't anything you can do in your C# code to change things.
All I can offer is two suggestions:
- try to install a relevant Korean language pack onto the machine that you're querying from; it could be that right now it is unable to resolve the culture, but that installing the language pack into Windows helps it understand - untested
- see if you can change the database collation; now obviously, this is a huge change that has massive impact, so shouldn't be done lightly - and ideally only after all other approaches have failed
The third option, of course, might be to see if the EF or SqlClient folks (overlapping teams) are responsive on github; they're under dotnet/corefx. The public github is mostly ".NET Core" however, so a great place to start would be to confirm that the same problem happens on .NET Core; if so, it'll be much easier to engage with people.
Disclaimer: everything here is from hacking through the call tree, and I do not make any claim to be authoritative on this.
answered Nov 13 '18 at 9:48
Marc Gravell♦Marc Gravell
779k19321322541
779k19321322541
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
add a comment |
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
I tried using normal ADO SqlConnection and it works. so why only EF have issue?
– Hybridzz
Nov 13 '18 at 10:30
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
@Hybridzz oh, that makes it even more interesting then - and frankly, it makes it a question for the EF team.
– Marc Gravell♦
Nov 13 '18 at 10:31
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
hmm. i have updated the question. By the way i tried installing the language to the machine. still EF way is throwing error. I am unable to do 2 as it is not my DB.
– Hybridzz
Nov 13 '18 at 10:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277604%2fc-sharp-entity-framework-querying-stored-procedure-error-culture-is-not-support%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It may because the stored procedure may be requiring 'Culture' parameter but you are not providing it.
– yogihosting
Nov 13 '18 at 9:23
no, there is no such parameter.
– Hybridzz
Nov 13 '18 at 9:24
ok please provide full code for the comments section '//command and parameters prepared here' and also the stored procedure which you have (if any)
– yogihosting
Nov 13 '18 at 9:26
I have edited the question
– Hybridzz
Nov 13 '18 at 9:32
1
the only code-path I can find that doesn't pass -1 is
SqlClient.SqlDataReader.GetOrdinal, which passes_defaultLCID; this comes from the_parser.DefaultLCID- which looks like it comes from the TDS stream (an "env" change, type 5); so indeed, my initial thought is that: SqlClient (not specifically EF) hates your SQL Server's collation!– Marc Gravell♦
Nov 13 '18 at 9:40