private void button1_Click(object sender, EventArgs e) { Item_Info itemInfo = new Item_Info(); itemInfo.DEC_ITEM_ID = itemId; itemInfo.CHR_ITEM_NAME = textBox1.Text; itemInfo.CHR_ITEM_SIZE = textBox2.Text; itemInfo.REL_ITEM_PRICE = Convert.ToDouble(textBox3.Text); itemInfo.CHR_APP_TIME = DateTime.Now.ToString(); SQLiteContext context = Form1.SqlHelper(); context.Update(itemInfo); Close(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim().Length > 0 && textBox2.Text.Trim().Length > 0 && textBox3.Text.Trim().Length > 0) { string itemName = textBox1.Text; string itemSize = textBox2.Text; double itemPrice = Convert.ToDouble(textBox3.Text); string currTime = DateTime.Now.ToString(); SQLiteContext context = Form1.SqlHelper(); Item_Info itemInfo = new Item_Info(); itemInfo.CHR_ITEM_NAME = itemName; itemInfo.CHR_ITEM_SIZE = itemSize; itemInfo.REL_ITEM_PRICE = itemPrice; itemInfo.CHR_CRE_TIME = currTime; context.Insert(itemInfo); Close(); } else { MessageBox.Show("所有输入都不能为空!重新输入!"); } }