Sitemap

Amicuk Programming Answers

Verification on delete statement

2015-10-11   Views:0

Advertisement

Hi i need a verification on delete statement and am trying to execute this delete using prepareStatement and through parameter passing the code is given below.plz do let me know the problem with the statement =========================================

Hi
i need a verification on delete statement and am trying to execute this delete using prepareStatement and through parameter passing
the code is given below.plz do let me know the problem with the statement
=============================================================
public int delete(String tableName,String empName){
          int n=0;
          System.out.println("Starting!!!delete");
          try{
               /*stmnt=con.createStatement();
               stmnt.executeUpdate("delete from Employees where Name= 'jaggu'");*/
               stmt=con.prepareStatement("delete from ? where Name = ? ");
               stmt.setString(1, tableName);
               stmt.setString(2, empName);
               n=stmt.executeUpdate();
          System.out.println("Deletion Done!!!");
          }catch(Exception e){
               System.out.println("Error on deletion :"+e);
          return n;
===========================================================
the error being displayed is:
Error on deletion :java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' where Name = ''' at line 1"
PLZ DO LET ME KNOW WHAT IS WRONG HERE!!!

The replay answer
Advertisement
yes tat was the problem and now i got it rectified.. for more dynamisation u can use the following code. If so u can delete any row based on the column value from any table...plz tell whether its looking fine or not:
     public int delete(String tableName,String empName){
          int n=0;
          System.out.println("Starting!!!delete");
          try{
               stmt=con.prepareStatement("delete from "+tableName+" where name = ?");
               stmt.setString(1, empName);
               n=stmt.executeUpdate();
          System.out.println("Deletion Done!!!");
          }catch(Exception e){
               System.out.println("Error on deletion :"+e);
          return n;
     }

Go to See the other 3 answers

Verification on delete statement

Category:DefaultRelease time:2015-10-11Views:130

Hi i need a verification on delete statement and am trying to execute this delete using prepareStatement and through parameter passing the code is given below.plz do let me know the problem with the statement =========================================[More]

IOS 7apple id verification when deleting iCloud account or linking new iCloud account to a device for find my iPhone

Category:DefaultRelease time:-0001-11-30Views:130

In iOS7 devices are activation locked when they are linked to an apple ID find my iphone. It seems that this will occur only once the apple id / find my iphone is enabled from iOS7 itself. But, with the phone in hand, I was curious if changing the ap[More]

All questions even to here being flagged and requiring additional verification

Category:DefaultRelease time:-0001-11-30Views:130

I can't even show you what I'm trying to ask a question about because all my questions even to here are being flagged and require additional verification. Why is this happening and why are my questions being deleted upon this action? As I tried to sa[More]

Tables for invoice held documents

Category:DefaultRelease time:-0001-11-30Views:130

Dear All, May i know the sap table for Invoice held documents. Please suggest Thanks in advanceu can get the details in table RBKP  field RBSTAT and details are 1     Defined for background verification 2     Deleted 3     With Errors 4     Correct ([More]

GR Based Invoice Verifcation indicator

Category:DefaultRelease time:-0001-11-30Views:130

Hello All, In the PO GR based Iv indicator is set. It is not selected in Vendor master and InfoRecord. Can anyone expalin the possibility of the indicator set. ThanksHi! please check the documentation for this field also. Indicator: GR-based invoice[More]

Why is the  finder copying before burning?

Category:DefaultRelease time:-0001-11-30Views:130

I was just preparing my first dvd backup using the finder to burn the dvd and I was surprised that as I dragged items to the dvd disc to prepare for burning, it seemed to be actually copying these items to some location before I could burn the dvd. I[More]

Deliveries for which F8 has been done are appearing in VF04

Category:DefaultRelease time:-0001-11-30Views:130

Dear all, Deliveries for which proforma invoice F8 has been done , are appearing in VF04. I know that +/- indicator is absent in VTFL. What other ways are there to adress the issue. Pl. help. regards.Hi, The delivery LF where Performa invoice F8 is c[More]

Mail continues to freeze?

Category:DefaultRelease time:-0001-11-30Views:130

Since upgrade to Maverick,  the beautiful beach ball spins on regular occasions freezing the rest of my MacBook Pro. 2.3GHz Intel Core i7 with 8 GB DDR.  I have trashed various Mail preferences, reset PRAM, Repaired permissions and ran disk verificat[More]

Which part is wrong for the script?

Category:DefaultRelease time:-0001-11-30Views:130

I want to copy files and directories over to c:\temp2 and then verify whether all files and folder are copied over after verification then delete or remove the source. I am not sure which part is wrong, the copy is working but not delete part. $Sourc[More]

Doubt in BAPI_INCOMINGINVOICE_GETDETAIL

Category:DefaultRelease time:-0001-11-30Views:130

Hi Friends.. If I use the function module BAPI_INCOMINGINVOICE_GETDETAIL, I can able to get the details of the document, But how can I know its a parked or posted Document. or is there any way to get the details of parked or posted document. Thanks G[More]

How can I delete my iCloud account when it is sending a verification email to an address which is no longer accessible?

Category:DefaultRelease time:2015-10-11Views:130

I recently changed my old iTunes User id from an old, defunct, and inaccessible email address to a new and active one.  To do this I went to iTunes 'Manage your Account'.  At the same time, I changed my password, and this has been working fine. Howev[More]

Hot
Is there a way to stop Firefox from suggesting to add new search engines to my search bar whenever I visit websites that suggest to us to add their search engines? I searched a lot and couldn't find any help. How to stop websites from suggesting to m [More]
I am having problem to detect the apple tv unit on this Philips led tv. Probably I need to select another unit than "other". Any suggestions?Sounds like it. Do you see the status light though? If not then it's either not on or there are other is [More]
Hi Everybody, I'm new to ALE/ IDocs and trying to trigger a ZFM from a delivery. An IDoc is generated when an o/p type is created. When I do that it is generating the IDoc but if I put a break point to chk my code in FM where IDoc is getting generate [More]
Lately, I'm experiencing a weird issue with SSH. I have 15 keypairs for various machines that I connect to for administration or other work. When trying to login to a server SSH will fail after it presents 3 incorrect keys to the server. This number [More]
I forgot my entry pass word for my iPad does anyone no how to unblock itIf you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the [More]
Anyone else have this problem? Acrobat reader freezes when I try to print some - not all - pdf documents. When this happens I can't quit reader and the print dialog box refuses to close. The only solution is to force quit reader. Interestingly, when [More]
I tried a lot to find out i-tunes for Windows XP Professional x64 bit but i didn't get any solution for installing i-tunes in my laptop which had Windows XP Professional x64 bit. when i asked to other person then at last i found only one reply that, [More]
Hi , This is Venkat. I am new to OWB. When I run the mapping I am getting the ORA-00001: unique constraint violation error. My loading type is Update/Insert. My target table Primarykey is combination of 3 keys. Please give me the suggestions. It is v [More]
Hi, suppose i had added one characteristic in cube definition, and created a sepearate dimension for that charactristic. is it mandatory that the characteristic is master data? if the added field is not master data, can we make it as a seperate dimen [More]
After years of no problems I sddenly can't print photos. When I select print I get the message "There are no themes located. Until at least one theme has been installed this feature will be unavailable.  What are themes? How do I install them? Why ha [More]