hi,
i'm working on windows application and sql serverCE database i write this code:

private void enregistrerBtn_Click(object sender, EventArgs e)
        {
            
            if (!exist)
            {
                
                SqlCeConnection conn = new SqlCeConnection();
                conn.ConnectionString = @" Data source= |DataDirectory|\Database1.sdf";
                try
                {
                    conn.Open();
                }
                catch (Exception ex)
                {
                   MessageBox.Show(" connexion failure");
                }
                finally
                {
                    
                    int r;
                    System.Data.SqlServerCe.SqlCeCommand cmd1 = new System.Data.SqlServerCe.SqlCeCommand ("INSERT INTO Condamne(Nom,Prenom,AnneeJugee,LieuNaissance,NomPere,NomPrenomMere,LieuResidence,SituationFamiliale,NomFrançais,PrenomFrançais)VALUES('" + nomTextBox.Text + "','" + prenomTextBox.Text + "','" + dateJugementTextBox.Text+"','"+LieuNaissanceTextBox.Text+"','"+prenomPereTextBox.Text+"','"+nomMereTextBox.Text+"','"+lieuResidenceTextBox.Text+"','"+sit uationFamilialeComboBox.Text+"','"+nomFrançaisTextBox.Text+"','"+prenomFra                  nçaisTextBox.Text+ "');", conn);
                   
                    r = cmd1.ExecuteNonQuery();
                    MessageBox.Show(" add operation success");
                   
                }
                conn.Close();
            }
            
        }

my problem is that when i execute this code the operation of inserting in the " condamne" table is successfully. but when i do an operation of search of this new person added in the table i don't find it.
i hope you can help me and execuse my bad english

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

hi,
thanks for replay but i mean that when i use a ' select' query to search the record inserted i don't find it. is it that because i use DATADIRECTORY in the path of database or what?
thanks again.

This article has been dead for over six months. Start a new discussion instead.