1.DELETE FROM "SALGRADE" WHERE id = :id
2.INSERT INTO "SALGRADE" ("GRADE", "ID", "TEST") VALUES (:GRADE, :ID, :TEST)
3.UPDATE "SALGRADE" SET "GRADE" = :GRADE, "TEST"= :TEST where "ID" = :ID
具体实现代码:
先看一个半路失败的强类型
SALGRADETableAdapter adapter = new SALGRADETableAdapter();
OrclDataSet.SALGRADEDataTable data = adapter.GetData();
foreach (OrclDataSet.SALGRADERow r in data.Rows)//this is not typed dataset because the exist of the attribute :Rows
{
MessageBox.Show((r.HISAL).ToString());
MessageBox.Show("aa");
}
具体的使用:textBox1,是id(int),textBox2,是grade(int),textBox3是test(string)
主要代码
SALGRADETableAdapter adapter = new SALGRADETableAdapter();
int id;
int.TryParse(this.textBox1.Text, out id);
int grade;
int.TryParse(this.textBox2.Text, out grade);
string test = this.textBox3.Text;
//TestForm.OrclDataSet.SALGRADEDataTable table = adapter.GetData();
//for (int i = 0; i < table.Count;i++ )
//{
// if (table[i].ID == id)
// {
// table[i].GRADE = grade;
// table[i].TEST = test;
// }
//}
//adapter.Update(table);
adapter.UpdateQuery(grade, test, id);
lock (adapter)
{
adapter.InsertQuery(9999, 23, "another");
}
int id;
int.TryParse(this.textBox1.Text, out id);
lock (adapter)
{
adapter.DeleteQuery(id);
}