|
|
 |
| Oracle ASP Using ASP with Oracle databases. For Oracle discussions not specific to ASP, please see the Oracle forum. For more ASP discussions, please see the ASP forum category. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Oracle ASP section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

April 25th, 2009, 06:58 PM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problem updating table
Hello,
I have an Oracle DB with some table's, I can insert data to the table's, but when I want to update the table's there is nothing happend.
I use the query below written in Delphi.Prism. What is wrong with this query?
Code:
try
OracleConn := new OracleConnection;
OracleConn.Connectionstring := 'User Id=SCHULDHULP;Password=pass; Data Source=Omgeving;';
OracleConn.Open;
myOracleTransaction := OracleConn.BeginTransaction();
cmd := new OracleCommand;
cmd := OracleConn.CreateCommand;
if RadioButton2.Checked = true then SEXE := 'Man'else
SEXE := 'Vrouw';
if RadioButton5.Checked = true then VER := 'Ja' else
VER := 'Nee';
if RadioButton3.Checked = true then GEH := 'Ja' else
GEH := 'Nee';
if RadioButton7.Checked = true then MOB := 'Abonnement' else
MOB := 'Prepaid';
TextBox154.Text := BSNTxt.Text;
cmd.Connection := OracleConn;
cmd.CommandText := "Update AANVRAGER SET GESLACHT='"+SEXE+"',GEHEIM='"+GEH+"',ABONNEMENT='"+MOB+"',GAAT_VERHUIZEN='"+VER+"'WHERE ALGEMEEN.BSN = 9675463772";
cmd.ExecuteNonQuery();
OracleConn.BeginTransaction.Commit;
finally
OracleConn.Close();
OracleConn.Dispose();
end;
|

April 25th, 2009, 09:31 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: High Wycombe, UK, United Kingdom.
Posts: 344
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Have you tried printing out the contents of after you populate it to see what is in there ? Then if it looks ok try running that SQL in SQL Plus, or a similar DB tool, to ensure that it is valid, if you are not seeing the update then your SQL could be suspect, if the update works directly on the database then you will need to take another look at your code.
|

April 26th, 2009, 04:44 AM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply.
If I use this:
Code:
cmd.CommandText := "Update AANVRAGER SET GESLACHT='test' WHERE ALGEMEEN.BSN = 9675463772";
The query is not updating the table from code.
If I do the same query from querybuilder within Visual Studio 2008 then the table is updated.
There must be something wrong in the code.
|

April 26th, 2009, 06:10 AM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Greg,
It seems that for some other reason the cmd.CommandText produces an empty string. I have recoded it and now the update is perfectly done.
Code:
try
OracleConn := new OracleConnection;
cmd := new OracleCommand;
OracleConn.Connectionstring := 'User Id=SCHULDHULP;Password=pass; Data Source=Omgeving;';
OracleConn.Open;
cmd.Connection := OracleConn;
cmd.CommandText := "UPDATE AANVRAGER SET GESLACHT = 'Vrouw' WHERE BSN = 9675463772";
cmd.ExecuteNonQuery();
end;
finally
OracleConn.Close();
OracleConn.Dispose();
end;
|

June 28th, 2009, 03:56 AM
|
|
Friend of Wrox
|
|
Join Date: May 2005
Location: OKC, OK, USA.
Posts: 211
Thanks: 1
Thanked 7 Times in 7 Posts
|
|
Willemt:
Just by "eyeballing" your update statement, I have a couple of suggestions: - Oracle recognizes "||" for concatenation;
- Did not see the "FROM" keyword in UPDATE statement;
- Not knowing your Scheme Definition for field BSN, if BSN is character, it needs to be enclosed in single-quotes '12345'.
Remember to write your SELECT statement for ORACLE using Delphi, not the other way around. Just a suggestion.
Hope this helps.
__________________
Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.
Last edited by peace95 : June 28th, 2009 at 04:02 AM.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |