Inserting into a table using data from a text box [message #443592] |
Tue, 16 February 2010 08:05 |
rosswelsh
Messages: 42 Registered: February 2010 Location: Sunderland
|
Member |
|
|
Hi all,
New to the forum and to PL/SQL and was hoping somebody could help?
I have a form that has one text box in it, and I want this value to be inserted into a table called StaffName, which has only one column, but im unsure as to how I would get my SQL statement to pick up this value.
I tried:
begin
insert into StaffName values ('addstaffmember');
end;
addstaffmember is the name of the text box.
this statement compiled but when I ran the form and tried to click save it would not work.
Any help would be greatly appreciated, im sure it must be quite simple but im a bit lost!
|
|
|
Re: Inserting into a table using data from a text box [message #443601 is a reply to message #443592] |
Tue, 16 February 2010 08:14 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Anything in quotes is a text string. You've told it to insert the value addstaffmember rather than the value of the item.
Correct code:
insert into StaffName values (:<block_name>.addstaffmember);
However what you really want is:
<this space left blank deliberately>
As forms handles inserts automatically for you.
|
|
|
|
|
|
Re: Inserting into a table using data from a text box [message #447941 is a reply to message #443592] |
Thu, 18 March 2010 10:51 |
BS_99
Messages: 34 Registered: March 2010
|
Member |
|
|
Hello frnd,
hope my reply could help your problem.
insert into StaffName(Fieldname1)
values(:block_name.addstaffname);
commit;
--in fact the textfield from which you are picking the value is a bindvariable and it should not be written withinn qoutes.
and the bindvariable name should be followed by the block name
as follows
:block1.textitem_name
try this,i hope it wd work.
Regards
Bibek.
|
|
|