Our software was installed on (customer site) Window Server 2008 R2 Foundation in Turkey (So locale is set to Turkish, and thus all menus and messages are displayed in Turkish). We are using SQL server 2005 express. The database collation is SQL_Latin1_General_CP1_CI_AI
(as in our other English installed sites).
Our code query the database with a 开发者_JAVA技巧simple query: select * form tableName where callid='variable'
(callid is our primary key, however the column name in the database is CallID, column type is varchar(60)
), using SqlDataAdapter.Fill()
method to fill our untyped DataSet
.
We yield the DataRow
object from DataSet.Tables[0].Rows[0]
. We pass this DataRow
object to other methods and we use DataRow.Item (String) to get the columns values. We have several columns that we get their values this way with no problems. However for one particular column we get
ArgumentException: <column name> column does not belong to table Table
This column is our callid column! When we change the column name in database to callid, or CalliD we don't get the exception. I've seen this article called Introduce the Turkish I issue and as I understand it the issue the article address is when collation = TURKISH_CI_AS.
What am I missing here? I'd appreciate any helpful input.
Thanks, Ilan
My guess is that the problem isn't occurring on the database side at all, but when the local code (DataSet
) is looking for your column.
The simplest fix is probably to use the column ordinal value instead of the name. For diagnostic purposes, I suggest you look through the column names returned by DataTable.Columns
and try various approaches to match the name in a case/culture-insensitive way. If you don't know the ordinal up-front, you might want to find it that way dynamically, if getting the DataSet
to find it fails :(
精彩评论