RE: How to check existence of a record while inserting data in to a table ?
You can write a select statement based on primarykey of your table.
Suppose your Table has PrimaaryKeyABC with one field inside that key you can write something as under
Select firstonly tableNameBuffer
Where tableNameBuffer.FielldNameofPk == _SomeValue;
If(!tableNameBuffer) //if does not exists !
{
//insert
}
Similarly if your Table has a composite primary key, write statement accordingly.
Select firstonly tableNameBuffer
Where tableNameBuffer.Fielld_1_NameofPk == _SomeValue
&& tableNameBuffer. Fielld_2_NameofPk == _someOtherValue;
If(!tableNameBuffer) //if does not exists !
{
//insert
}