There's no catch here so there could be an error happening and you may not know about it.
The other thing is try to execute the insert statement from the Sql Query Analyzer or a query window launched from Server Explorer. That may tell you if there's something wrong with the SQL statement. On Feb 10, 8:39 am, Johnny <[email protected]> wrote: > Hi all, > > Im new to desktop development in .net, Ive been tring to insert data > into an sql server ce database and it does not seem to be updating > properly. Ive tried using both the tableadapter.insert() method and > also using sql strings and both didnt work correctly. > > In the code below I have checked to see if the rows were inserted > using cmmd.ExcuteCommandNonQuery() and it confirms on row was updated > but when opening the server explorer the data was not inserted. > > Any help would be appreciated > John > > SqlCeConnection conn = null; > > try > { > conn = new SqlCeConnection("Data Source = | > DataDirectory|\\Database1.sdf;"); > conn.Open(); > > SqlCeCommand cmd = conn.CreateCommand(); > cmd.CommandText = "INSERT INTO Record ([ABV], > [measure], [AlcoholName]) Values(55 ,789 ,'test')"; > > int connam = cmd.ExecuteNonQuery(); > > } > finally > { > conn.Close(); > > } > > }
