Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name     = "test1113";
            string birthday = "2018-07-21";
            string location = "wh";
            string sex      = "Male";
            string sql      = string.Format("INSERT INTO patient VALUES (NULL, '{0}', '{1}', '{2}', '中国', NULL, NULL, NULL, NULL, NULL, 0, 0, 0, '{3}', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 10, 0, 0, 76, 88, 85, 91, 98, 64, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0, 1, 1, 1, 1, 1, 2, NULL, NULL, NULL);", name, birthday, location, sex);
            string clearSql = "Delete from patient";
            string dbpath   = "C:\\Clasp32\\DATA\\data.db3";

            try
            {
                AgentDll.exec_sql(dbpath, clearSql);
                AgentDll.exec_sql(dbpath, sql);
                MessageBox.Show("数据插入成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show("dbAgent数据插入失败" + ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                WriteLog("dbAgent数据插入失败" + ex.ToString());
            }
        }
Beispiel #2
0
 public void ExecSql(string dbpath, string sql)
 {
     AgentDll.exec_sql(dbpath, sql);
 }