Updating a table via form
Hello -
I'm trying to do what (should) be an easy task, but i'm
pulling out what's left of my hair. I can't seem to update an
Access table.
tble_message has the following fields:
messagesID : autonumber/key
to [data type number]
from [data type text]
Date [data type Date/Time]
message [data type text]
time [data type Date/Time]
I created the following form:
- - - begin form.cfm - - -
<FORM
ACTION="input2.cfm?newcall2=YES&toID=#URLEncodedFormat(toID)#&budName=#URLEncodedFormat(b udname)#"
Method=Post>
<INPUT TYPE="hidden" NAME="to"
VALUE=<cfoutput>#toID#</cfoutput>>
<INPUT TYPE="HIDDEN" NAME="from"
value=<cfoutput>"#LoginName#"</cfoutput>>
<INPUT TYPE="hidden" NAME="DATASOURCE" VALUE="testdb">
<INPUT TYPE="hidden" NAME="TABLENAME"
VALUE="tbl_Messages">
Message to: <cfoutput>#budName#</cfoutput>
<TEXTAREA NAME="YMESSAGE" ROWS="5" COLS="40"
WRAP="Virtual"></TEXTAREA>
<INPUT TYPE="Submit" VALUE="send message">
<INPUT Type="reset" Value="start again">
</form>
- - - end form.cfm - - -
this form feeds input2.cfm
- - - begin input2.cfm - - -
<cfoutput>
#message#
#toid#
#loginName#
</cfoutput>
<cfquery name="addmess" DATASOURCE="testdb">
Insert Into tbl_Messages
(message,to,from)
Values
('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</c foutput>'
</CFQUERY>
- - - end input2.cfm - - -
i do see the expected values in my cfoutput:
<cfoutput>
#message#
#toid#
#loginName#
</cfoutput>
= = = error message = = =
I am getting an Error Executing Database Query
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft]
[ODBC Microsoft Access Driver] Syntax error in Insert Into
statement
the error occurred in c:\.... input2.cfm: line 21
20 Values
21
('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</c foutput>')
22 </CFQUERY>
= = = end error message = = =
Form Fields:
fieldnames:to,from,datasource,tablename,ymessage
from=chancho2000
tablename=tbl_messages
to=100
ymessage=testing the input form
url parameters:
newcall2=yes
toID=
.. i just can't seem to populate the database
any help or direction would be appreciated.. thanks!
dieg0
dieg02000 wrote:
> .. i just can't seem to populate the database
What is happening? Are you receiving an error, if so what is
the full error message?
> <cfquery name="addmess" DATASOURCE="ritmo2000">
> Insert Into tbl_Messages
> (message,to,from)
> Values
>
('<cfoutput>#message#</cfoutput>','<cfoutput>#toid#</cfoutput>','<cfoutput>#loginName#</c foutput>'
> )
I do not use Access but FROM is almost certainly a reserved
keyword and should not be used as a column name. Try renaming it. I
do not know about the other column names like "To".
Though it may not cause an error the <cfoutput> tags
are not needed and should be removed. The #variables# should be
evaluated automatically. Also consider scoping your variables to
avoid conflicts and using cfqueryparam. Something like
<cfquery name="addmess" DATASOURCE="ritmo2000">
Insert Into tbl_Messages (message, to, TheRenamedFromColumn)
Values
<cfqueryparam value="#form.message#"
cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#toid#"
cfsqltype="cf_sql_integer">,
<cfqueryparam value="#loginName#"
cfsqltype="cf_sql_longvarchar">
Similar Messages
-
Updating database table via program
Hi,
I am updating a DB table (Sap standard table) via my program.
I have few doubts with regard to same. They are given below,
1. I came to know that it is not best practise to update the sap standard table via program using "update" statement. Why so? Is there any other way or statement in doing the same?
2. The sap standard table which i update via my program is BDRGIN. Now my question is, when my program is modifying the values of the table, if some other user also modifies the value at the same time via SE16 then conflict occurs. How to resolve it? Is SAP uses any automatic handling for such conflicts?
kindly help me out.
Regards,
Raghavendraprasad.NHi,
Its not a good practise to modify the Standards tables through programs, because most of the standard tables will be interdependant with forign key relation ships (check table relations). So incase we create an irrelavant entry, then it will cause a lot of confusions.
For example we create entries in MARA/MAKT table using MM01/02 transactions.
There are a few standard tables like TVSA (containing customising data), these have to be maintained through the SPRO transaction. You can open SPRO transaction and search for the node to maintain entries in it or you can go to the transaction SM30 and you can give the table name and click on customizng to go the SPRO node.
Still if you are trying to create entries in your table, Enque/Lock the table do the updations and then Deque/Unlock the table, so that there will be no conflicts happening during that time.
Regards,
S.Dakshna Nagaratnam. -
Updating a table via a gui program
i am trying to update a record via the UPDATE function. My program has a show all button that brings in all the records. When i make a change in the record and click Update. I get the error: Syntax error in string in query expression ''00000' the zeroes represent an updated zipcode. Here is my source code for the update function:
if(e.getActionCommand().equals("Update"))
String url = "jdbc:odbc:coffee";
String driver= "sun.jdbc.odbc.JdbcOdbcDriver";
Connection con= null;
Statement stmt =null;
//PreparedStatement stmt = null;
ResultSet my_result= null;
/* String query = "Update CoffeeSuppliers set " +
"Name='" + comp_Name.getText() +
"', Address='" + comp_Addr.getText() +
"', City ='" + comp_City.getText() +
"', State='" + comp_State.getText() +
"', ZipCode='" comp_zipcode.getText()
"' WHERE ID=" + comp_ID.getText();
String query= "Update CoffeeSuppliers set " +
"ID='" + comp_ID.getText() +
"', Name='" + comp_Name.getText() +
"', Address='" + comp_Addr.getText() +
"', City='" + comp_City.getText() +
"', State='" + comp_State.getText() +
"', ZipCode='" + comp_zipcode.getText();
try
Class.forName(driver);
catch(java.lang.ClassNotFoundException exception)
System.err.print("ClassNotFoundException: ");
System.err.println(exception.getMessage());
try
con = DriverManager.getConnection(url,"app","app");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
my_result= stmt.executeQuery(query);
stmt.executeUpdate(query);
while(my_result.next())
System.out.println("am i in the while loop");
my_result.updateString(1,comp_ID.getText());
my_result.updateString(2,comp_Name.getText());
my_result.updateString(3,comp_Addr.getText());
my_result.updateString(4,comp_City.getText());
my_result.updateString(5,comp_State.getText());
my_result.updateString(6,comp_zipcode.getText());
my_result.updateRow();
stmt.close();
con.close();
catch(SQLException sqlex)
System.err.println("ERROR: " + sqlex.getMessage());
} //end of the if statement
Any feedback will be great.
thanksString query= "Update CoffeeSuppliers set " +
"ID='" + comp_ID.getText() +
"', Name='" + comp_Name.getText() +
"', Address='" + comp_Addr.getText() +
"', City='" + comp_City.getText() +
"', State='" + comp_State.getText() +
"', ZipCode='" + comp_zipcode.getText() + "'";I think that it is as simple as the fact that you diddn't close the zipcode string literal being passed to the SQL interpreter. Add the closing ' to the query
Hope this helps,
Bamkin -
Updating a table via an insert statement
Can someone please assist me with this code. I am attempting to insert into a table through another table. Can anyone see what is wrong with this code?
insert into passwd_verify select user_id, user_name, first_name,
last_name, creation_date, email_address
from(select int_contactid, str_userid, str_fname,
str_lname, sysdate, str_email
from tbl_contact
where int_contactid = '201')
where passwd_verify.user_id <> tbl_contact.int_contactid;or something like:
insert into passwd_verify
select tbl_contact.int_contactid user_id,
tbl_contact.str_userid user_name,
tbl_contact.str_fname first_name,
tbl_contact.str_lname last_name,
tbl_contact.sysdate creation_date,
tbl_contact.str_email email_address
from tbl_contact,
passwd_verify
where int_contactid = '201'
and passwd_verify.user_id <> tbl_contact.int_contactid
-- OR --
insert into passwd_verify
select tbl_contact.int_contactid user_id,
tbl_contact.str_userid user_name,
tbl_contact.str_fname first_name,
tbl_contact.str_lname last_name,
tbl_contact.sysdate creation_date,
tbl_contact.str_email email_address
from tbl_contact
where int_contactid = '201'
and tbl_contact.int_contactid not in (select user_id
from passwd_verify)note: not tested. -
Updating a table with need of table joins
Hi,
I want to update a table (via PL/SQL process) but to do it I need to include joins - and my code throws an error...
How would I go about getting this to work?
UPDATE employees a, action b
SET a.met_employee = '0000'
WHERE b.date_met NOT BETWEEN QA1 AND QA2
AND b.date_met NOT BETWEEN QB1 AND QA2
AND b.date_met NOT BETWEEN QC1 AND QC2
AND b.date_met BETWEEN QD1 AND QD2
AND b.emp_id = P12_ID
AND a.emp_id = P12_ID;
Where QA1, QA2, QB1, QB2, QC1, QC2, QD1, QD2 are variable values of pre-defined dates and P12_ID is the ID variable.
The problem occurs because I need to use the two tables - how can I solve this?
Thanks,
SiThe employee table has multiple actions (action table)
We want to set certain values i.e the '0000' to certain employees that have had actions on certain dates (the defined variables)
So it needs to check all the actions within the set dates and give only employees within this criteria the value '0000'
with the following...
update emplyees
set met_emplyees = '0000'
where emp_id = P12_ID;
that will always set the employee with '0000'. However '0000' should only be set to employees that had actions on certain dates.
Cheers
Si -
I created a form with two blocks.
one of them is a select block for the user
(not based on a database table) and the other
one contains the result (through given parameters
from the first block[the user's query]).
after the execution of the query and based on the
data (id) that I got in the second block I would like
to update another table (database table not shown in the form)
I created a trigger that calls a procedure. it shows that the
procedure is executing(using outputs) but there is no update
in the target table. by the way when trying to close the form(runtime)
it asks if I would like to save the changes when pressing yes there is an
error message :"FRM-40508:ORACLE-error-cannot insert record(INSERT)".
when using the button (trigger) and calling the procedure I get the same
error message when I have a commit in the procedure. in PL/SQL when calling
a procedure via a trigger there is no need for a commit. is it the case also
in a form trigger? and if so why doesn't it update the table? ps.the same procedure
when executed in sql works good.
i tried it also with (execute_query) as suggested but it does not work.
please respond.
thanks in advance.Do you have any other triggers in the form like on-insert/on-update/on-delete???
If any of these are present then it overrides the operation you are trying to perform.. -
How to use one form to update two tables
How can I do that? HTMLDB wizard or form on table doesn't give me an option to use more than one table in a form or I don't know about it. I created new process which redirects the form to another page after submitting the form. On the second page I created new process which uses the same variables from the previous form page. This process runs on page load before header but it is just not working right.
So, what is the proper way to update two tables with the same form fields?Hello Vikas,
"The Automatic Row Fetch and Automatic DML processes are a pair, you can't have one without the other."
Are you sure about that? I have a page, which populate some of the items from TableA, using manual select statement, and after the user input, save some of it in TableB, using Automatic DML. No ARF in this process and it seems to work just fine. Come to think of it, what about a simple form, populated entirely by the user input, and then being saved to the db, using Automatic DML? No ARF here also.
For the problem in hand, if you can't have more then one Automatic DML per page, I think that the simplest solution will be to define a pl/sql process, with two INSERT statement to the two different tables.
Regards,
Arie. -
Is it possible to update multiple tables with a dynamic form?
I have columns from two tables populating a dynamic form. I am trying to have the form update both tables on submit. I have tried both a linked transaction and a custom transaction but I am not making progress. Only the master table is being updated. Is it possible with ADDT to update two tables with a dynamic form?
I meant
SXMSMSTAT
SXMSSYERR
Thanks. -
Two forms that update differrent tables on the same page?
I tried to add two forms that update different tables on to one page.
Problem is when I do that the forms gives me an error saying the field does not exist. It's like it is trying to update one table with the other tables fields.
As an example Say I have one forms that is for people table and another one that is the Jobs table.
When I go to update the people table, it sends the data for the jobs fields too I get an error like the field job description does not exist.
I have two different forms for these and everything.
I would hope it is possible to have two forms that update different tables on the same page.I was trying the exact same thing, but i managed to work round it by setting the steps to hide one region, so the user would enter the form see one region submit the region then direct back to the same page with the different region visible and the original hidden.
I don't know if this would be acceptable for you... -
Updating a table from tabular form using a process
Hi
I have a tabular from creating using wizard
I've a field called Last_updated_by in the table
the username is assigned to an item P2_user based on the user who logs in.
What I need is,when any row is updated, I need to update the last_updated column with value in p2_user.
Need help on this
I'm using apex 3.2 with 11g
tried the below
declare
idx number:=1;
begin
FOR i in 1 .. wwv_flow.g_f01.COUNT
LOOP
for j in idx .. wwv_flow.g_f02.count
loop
update table_name set last_updated_by=:p2_user where ID=APEX_APPLICATION.G_F02(j);
idx:=j+1;
end loop;
END LOOP;
end;
Its updating the table,but all the rows are getting updated,just not the selected rows.
Not sure what I'm doing wrong here
thanks
Archana
Edited by: Agowda on Jan 12, 2012 1:55 AMI am looking for the same... can you please share how did you got this working
thanks -
Update custom Table Form DSO (in SAP BI)
Hello everyone,
i need to load a custom table in SAP R3(4.6c) from a DSO in SAP BW (7.0).
My first idea was to use a RSANWB transaction with update CRM attribute funconality, but in Target system (SAP R3 4.6c) there is not the function module CRM_BW_PROTIDS_GET cause CRM was not istalled.
Do you have any other solution or a smart tip to use the CRM function?
Another info: Before load data into target table i need set a filter on source data and truncate target table.
Thanks a lot for your help.
EmilianoHi there,
Get your ABAP person to write an RFC function to read and pass the DSO table records and then update the table in SAP R/3. That will be the best option.
-Senthil -
Update MCHA table in exit EXIT_SAPLCOBT_001
Hi All,
I want to update batch in MCHA table via COR2 transaction.
I want to perform this update in exit EXIT_SAPLCOBT_001.
I am using BAPI_BATCH_CHANGE to update batch in MCHA table.
Actually exit already has one bapi BAPI_BATCH_CREATE.
So i am getting dump.
“Nested call of PERFORM ON COMMIT: NESTED_PERFORM_ON_COMMIT caller: SAPLV
01Z program: SAPLV01Z form: CHANGE_BATCHES”
Is there any way to rectify this error or any other way to complete the requirement.
Any help will be greatly appreciated.Hi,
pass data to a Z*FM with all required data,
create & call Z* FM as RFC enabled & call it in the either 2 ways:-
CALL FUNCTION func STARTING NEW TASK task
OR CALL FUNCTION func IN BACKGROUND TASK
If you make the FM RFC enabled and call it in background or Update task, the call to the FM is actually executed after the commit work in the calling program and it acts as a separate task and avoids Dump caused by the commit.
Note:- you should not call update, insert , delete on DB or use such FM's or BAPI's in an user exit/Badi.
Thanks,
Sharath -
How to update a table in database
Hi.
i am working on HR system. I have developed a form of report engine. Report Engine form contains no any database table but text items, buttons and options.
I have placed a button and in its when button press triger i wrote a procedure to update a table record as:
Update Empbiodata
Set Status = 'Retired'
Where Status = 'On Duty'
but that button is not updating the database record. when i add a line of Commit_form, after that i faced the error message there is no change to save.
I have run this code on SQL prompt and saw working well.
please solve the problem that why this code is not working in button press trigger in the form.
thnxHi Zaheerms,
You can do this kind of updates in the Forms.
I will help u in this scenario.
1st tell me the update column is a database item or not ?
Sample code :
begin
Update Empbiodata
Set Status = :block.column_name --'Retired'
Where Status =:block.column_name -- 'On Duty'
commit;
-- For checking message
fnd_messahe.set_string('Testing'||:block.column_name);
fnd_message.show;
end;
and give some condition as per ur requirement.
I think so this will help you.
If not post again and i will try to clarify you.
thanks,
SIvaprasad -
Progammatic update a table with a database view in the page
Hi All,
I am using JDev 11g. With FOD database schema, I have one database view Products which comes from two tables Products_Base and Product_Transactions. I created three EOs (ProductEO, ProductsBaseEO, ProductTransactionsEO) and three VOs (ProductVO, ProductsBaseVO, ProductTransactionsVO) based on their EOs respectively.
Here is my scenario. I have an ADF form which is based on the database view Products and is dragged and dropped from Data Controls->ProductVO. When an existing record is submitted, a backing bean method will be called to update the data against the table Products_Base (and the table Product_Transactions at the same time) programmatically. An update method updateProductPrice() is added into the Application Module and published it to UI Client. The submit button in the page is created by directly dragging and dropping Data Controls->updateProductPrice into the page. When I run it, I got the following error message,
Failed to post data to database during "Update": SQL Statement "UPDATE PRODUCTS ProductEO SET COST_PRICE=:1 WHERE PRODUCT_ID=:2".
What I don't understand here is that, in my update method updateProductPrice(), it supposes to update the table Products_Base. But from the error, it appears that it is trying to update the view Products. Can anyone give me a help on what I did wrong here? When I try to debug it, it throws an exception to this line in the method updateProductPrice(),
getDBTransaction().commit();
Here are my codes,
The method which got called in the backing bean
public String cb6_action() {
DCBindingContainer bc = (DCBindingContainer)getBindings();
FacesCtrlAttrsBinding ProductId = (FacesCtrlAttrsBinding)bc.get("ProductId");
FacesCtrlAttrsBinding CostPrice = (FacesCtrlAttrsBinding)bc.get("CostPrice");
JUCtrlActionBinding action =
(JUCtrlActionBinding)bc.findCtrlBinding("updateProductPrice");
DCDataControl dc = action.getDataControl();
ApplicationModule am = (ApplicationModule)dc.getDataProvider();
AppModule service = (AppModule)am;
service.updateProductPrice(new Long(ProductId.toString()), CostPrice.toString());
return null;
public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
The update method defined in the Application module (AppModuleImpl.java)
public void updateProductPrice(long productId, String costPrice) {
ProductsBaseEOImpl product = retrieveProductById(productId);
if (product != null) {
try {
product.setCostPrice(new Number(costPrice));
getDBTransaction().commit();
catch (JboException ex) {
getDBTransaction().rollback();
throw ex;
catch (SQLException ex1) {
getDBTransaction().rollback();
private ProductsBaseEOImpl retrieveProductById(long productId) {
EntityDefImpl productDef = ProductsBaseEOImpl.getDefinitionObject();
Key productKey = ProductsBaseEOImpl.createPrimaryKey(new DBSequence(productId));
return (ProductsBaseEOImpl)productDef.findByPrimaryKey(getDBTransaction(),productKey);
Edited by: john wang on Oct 27, 2009 7:14 AMor
merge into test
using (select rowid rid
, id
, sub_id
, startdate
, lead (startdate) over (order by id, sub_id) - 1 ed
from test) x
on (x.rid = test.rowid)
when matched then
update set end_date = x.ed
; -
How To Update A Table View From Client Side !!!!
Hi I would like to update a table view from the Client Side. So that the user can keep updating the relevent data on the client and when they have finally finished they can press Save so the entire page is then sent to the Server.
Does anyone know how to do this, I guess u have to use the EPCM, I have just started on it and would really appreciate some Help.
Thanks,
Emmanuel.This is what I found :-
There are a couple of ways to approach this.
1) load the excel spreadsheet into the database "as is". You can use interMedia
text to convert the .xls file into a .htm file (HTML) or use iFS (see
http://technet.oracle.com/
for
more info on that) to parse it as well. InterMedia text will convert your XLS
spreadsheet into a big HTML table (easy to parse out what you need at that
point)
2) Using OLE automation, a program you write can interact with Excel, request
data from a spreadsheet, and insert it. Oracle Forms is capable of doing this
for example as is other languages environments. In this fashion, you can remove
the "manual" and "sqlldr" parts -- your program can automatically insert the
data.
3) You can write a VB script that uses ODBC or Oracle Objects for OLE (OO4O) in
Excel. This VB script would be able to put selected data from the spreadsheet
into the database. We would recommend OO4O. It provides an In-Process COM
Automation Server that provides a set of COM Automation interfaces/objects for
connecting to Oracle database servers, executing queries and managing the
results. OO4O is available from
http://technet.oracle.com
Maybe you are looking for
-
Free Goods line item in Billing Doc.
Hello SAP GURUS, I am working on ECC.6. I am processing the sales order and delivery for FREE GOODS every thing is fine but I not able to see the relavent free good item in the billing document.Can some one help me How to get the same. Thanks & Regar
-
Não recebimento de protocolo dos Correios para reparo
ID de Reparo: D82668451 - S/N 791139WMA4T - iPhone 4 Desde o dia 15 de janeiro de 2013 estou no aguardo do email com o procedimento e numero de protocolo dos correios para realizar o reparo. Liguei 3 vezes e ainda nao recebi o email que segundo a App
-
EDIT THE FIELV VALUE IN ALV GRID DISPLAY
Hi Guru , How can I edit the value of a particular one or two fields in ALV GRID DISPLAY . Please reply me
-
How do I create a welcome page for PDF portfolio in Acrobat X?
When making portfolios in v9 i was able to add a welcome page to my PDF portfolio. However, since I upgraded I am no longer able to locate this fucntion. Does it still exist and if so how do i access it? If it doesn't exist can anyone explain to me w
-
Hi guys, Perhaps, you can help in this query, SELECT Br FROM crm where project = :P2_Project :P2_Project : is " a value in a list of values Item" that contains X, Y, Z Only if the value "X" is picked, then It should be replace for another value such