We have to follow some steps,
Step 1:
Create a form with two controls and two buttons.
1.StudentName(Unbound Control) 1.Add button
2.IdNumber(Unbound Control) 2.Delete button
Unbound Control :-
Unbound controls are form level Design controls which does not added from a "Datasource."
Step 2:
Then create a table in which records should be save and delete.
Step 3:
Write the code in Clicked() method under Add button for adding the records.
void clicked()
TaskAddDelete taskAddDelete1;
super();
taskAddDelete1.StudentName=StudentName.valueStr();
taskAddDelete1.IdNumber=IdNumber.value();
taskAddDelete1.insert();
}
Step 4:
Now write code in Clicked() method under Delete button for deleting the records.
void clicked()
{
TaskAddDelete taskAddDelete1;
super();
delete_from taskAddDelete1 where taskAddDelete1.StudentName==StudentName.valueStr() &&
taskAddDelete1.IdNumber==IdNumber.value();
}
Step 5:
Finally open our table and you can find the records which we tried to add and delete.
Scenario:-
I have one form with two controls and two buttons. And I have one table.i want to add and delete records in the table by form.so now I am giving input into these two controls if I click add button records are saved into that table. If I click delete button records are deleted from that table.
Unbound Control :-
Unbound controls are form level Design controls which does not added from a "Datasource."
Step 2:
Then create a table in which records should be save and delete.
Step 3:
Write the code in Clicked() method under Add button for adding the records.
void clicked()
{
TaskAddDelete taskAddDelete1;
super();
taskAddDelete1.StudentName=StudentName.valueStr();
taskAddDelete1.IdNumber=IdNumber.value();
taskAddDelete1.insert();
}
Step 4:
Now write code in Clicked() method under Delete button for deleting the records.
void clicked()
{
TaskAddDelete taskAddDelete1;
super();
delete_from taskAddDelete1 where taskAddDelete1.StudentName==StudentName.valueStr() &&
taskAddDelete1.IdNumber==IdNumber.value();
}
Step 5:
Finally open our table and you can find the records which we tried to add and delete.
No comments:
Post a Comment