当我插入数据时,我可以在 DATAGRIDVIEW 中读取它们,但是当从数据库资源管理器中读取 Table1 时,我无法在 Table1 中找到存储的数据,此外,在那之后我丢失了 DATAGRIDVIEW 的数据。
将数据发送到数据库是否正确?
conn.ConnectionString =
"Persist Security Info = False; Data Source = 'table1.sdf';" +
"Password = '....'; File Mode = 'shared read'; " +
"Max Database Size = 256; Max Buffer Size = 1024";
conn.Open();
SqlCeCommand cmd = new SqlCeCommand("INSERT INTO Tp_Inr_Dosage (date, Tp, Inr, LastDosage, NewDosage, pathology_level, Pathology, idpatient) values( '" + DateTime.Now.ToString() + "', " + tpTextBox.Text.Replace(",", ".") + ", " + inrTextBox.Text.Replace(",", ".") + " ," + lastDosageTextBox.Text.Replace(",", ".") + ", " + newDosageTextBox.Text.Replace(",", ".") + " ," + pathologyComboBox.SelectedIndex + " , '" + pathologyComboBox.SelectedItem + "', '" + patient + "' )", conn);
cmd.ExecuteNonQuery();
conn.Close();
就像我的数据只进入缓冲区,它永远不会到达数据库