tags:

views:

21

answers:

1

hi

i have this code for fast search

Tmp = "";
            MAK = "";
            DES = "";
            Cmd.CommandType = CommandType.TableDirect;
            Cmd.CommandText = "Ham";
            Cmd.IndexName = "B";
            Cmd.SetRange(DbRangeOptions.Match , new object[] { txtMa.Text }, null);
            SqlCeDataReader read = Cmd.ExecuteReader();
            while (read.Read())
            {
                Tmp     = read[2].ToString(); 
                MAK     = read[0].ToString(); 
                DES     = read[1].ToString();
            }
            read.Dispose();
            if (Tmp == "")
            {

                return false;
            }
            else
            {

                txtDes.Text = DES;
                return true;
            }

it works excellent - but the problem is

when i search ABC and when i search abc i get the same resault

how to separate between them ?

thank's in advance

+1  A: 

Case-sensitivity of SQL searches would be a setting of your database.

In particular for SQL Compact Edition you need to make sure you are using a 3.5 SP1+ database with collation enabled at creation time, or otherwise apply these changes:

If you are referring to 3.5 RTM created file as old file, then you have an option: Using Server Explorer of Visual Studio or Object Explorer of SSMS: 1. Connect to the file 2. Select the file and right-click on it. Select Database Properties. 3. In Shrink and Repair pane of Database Properties dialog, you can change the Case Sensitive feature to true with the help of Advanced Properties dialog activated by Advanced button. P.S. You will have to perform either Compact or Repair operation.

For SQL CE files of 3.1 or previous version, you have to follow the same procedure but have to first upgrade that file to 3.5 SP1.

Source: http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/649f10a8-6880-46c4-82db-fb52b29614b9

I would recommend reading that source as it yields important information such as how case-sensitivity breaks backwards compatibility.

Graphain