Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i use local databasewith c#
this code work good with sql server database but do not work with sqlce

C#
SqlCeConnection JSS_cnn05 = new SqlCeConnection();
           JSS_cnn05.ConnectionString = Publics.jeus_Coonn;
           JSS_cnn05.Open();
           string JSS_check05 = "Select COUNT(*)FROM reg where reg_OK = '" + JSS_AUTH + "'";

           SqlCeCommand JSS_cd05 = new SqlCeCommand(JSS_check05, JSS_cnn05);
           JSS_cd05.CommandText = JSS_check05;
           int JSS_RowCount05 = (int)JSS_cd05.ExecuteScalar();
           if (JSS_RowCount05 == 0)
           {

               JSS_Regestation JSS_fr = new JSS_Regestation();
               JSS_fr.Show();
               this.Hide();
           }


           else
           {
               JSS_LOGIN JSS_fr = new JSS_LOGIN();
               JSS_fr.Show();
               this.Hide();
           }










           string JSS_connetionString001 = null;
           SqlCeConnection JSS_cnn001;
           SqlCeCommand JSS_cmd001;
           string JSS_sql001 = null;
           SqlCeDataReader JSS_reader001;
           JSS_connetionString001 = Publics.jeus_Coonn;
           JSS_sql001 = "select * from product_companies where prodc_ID=select max(prodc_ID) from product_companies)";
           JSS_cnn001 = new SqlCeConnection(JSS_connetionString001);
           try
           {
               JSS_cnn001.Open();
               JSS_cmd001 = new SqlCeCommand(JSS_sql001, JSS_cnn001);
               JSS_reader001 = JSS_cmd001.ExecuteReader();
               while (JSS_reader001.Read())
               {
                   label4.Text = (JSS_reader001.GetValue(0) + "");
               }
               JSS_reader001.Close();
               JSS_cmd001.Dispose();
               JSS_cnn001.Close();
           }
           catch (Exception ex)
           {
               return;
           }



any idea
Posted
Updated 5-Apr-15 10:31am
v5
Comments
Sascha Lefèvre 5-Apr-15 16:02pm    
Not meant as an answer:
Sql CE is discontinued; I would recommend you to use something different instead. See here:
http://stackoverflow.com/questions/20363374/is-sql-server-compact-discontinued-from-visual-studio-2013

Regarding your question: "but do not work with sqlce" is not a good description of the problem - I suggest you provide some more detail, e.g. the exact error message and if possible at which point of your program it occurs.
Golden Basim 5-Apr-15 16:34pm    
no mesage appear but no result ( no data appear )
PIEBALDconsult 5-Apr-15 16:28pm    
Maybe because of: string JSS_connetionString021 = null; ?
What is your connection string?
Golden Basim 5-Apr-15 16:36pm    
i don't think that , i used the same connection sring with other code and work good
PIEBALDconsult 5-Apr-15 16:48pm    
Then that's probably the reason; it probably has to be changed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900