I can't figure out how to parametrize my SQL statement - lil help please?

Hi all,
I was deleting records via the string-concatenation method, which I've come to understand is bad, due to security any possibly other issue. I want very much to parametrize my delete statement, but I just can't see to get it to work
The code below is my best shot at it - it returns an Oracle exception about "invalid table name". I assume that means the the substitution of the parameter for the value simply hasn't been performed, so the database is trying to process literally ":oracleTable", and the like.
Can someone please set me straight with this?
Thanks for any help,
cdj
          public static void DeleteTest(DateTime start, DateTime end)
               ParentFormStatusBar.Text = "Deleting records...";
               string oracleStart = start.ToString("dd-MMM-yyyy");
               string oracleEnd = end.ToString("dd-MMM-yyyy");
               string strConn = "CONNECTSTRING";
               OracleConnection dc_UAT = new OracleConnection(strConn);
               string oracleTable = "DATABASETABLE";
               OracleCommand oc = new OracleCommand();
               oc.BindByName = true;
               oc.CommandText = "delete from :oracleTable where as_of_date between :oracleStart and :oracleEnd";
               oc.Connection = dc_UAT;
               OracleParameter tableParam = new OracleParameter();
               tableParam.ParameterName = "oracleTable";
               tableParam.Value = oracleTable;
               tableParam.OracleDbType = OracleDbType.Varchar2;
               tableParam.Direction = ParameterDirection.Input;
               OracleParameter startParam = new OracleParameter();
               startParam.ParameterName = "oracleStart";
               startParam.Value = start;
               startParam.OracleDbType = OracleDbType.Date;
               startParam.Direction = ParameterDirection.Input;
               OracleParameter endParam = new OracleParameter();
               endParam.ParameterName = "oracleEnd";
               endParam.Value = end;
               endParam.OracleDbType = OracleDbType.Date;
               endParam.Direction = ParameterDirection.Input;
               oc.Parameters.Add(tableParam);
               oc.Parameters.Add(startParam);
               oc.Parameters.Add(endParam);
               MessageBox.Show(tableParam.Value.ToString()+ "\n" + oc.CommandText+"\n" + "Params: " + oc.Parameters.Count);
               int rowsAffected;
               try
                    dc_UAT.Open();
                    rowsAffected = oc.ExecuteNonQuery();
                    dc_UAT.Close();
                    ParentFormStatusBar.Text = rowsAffected.ToString() + " records deleted.";
               catch(Exception ex)
                    ParentFormStatusBar.Text = "Delete error: " + ex.Message;
          }

It helped oodles - thanks a jillion!
Is there a master list somewhere of things you can and cannot parametrize? That would be cool.
I guess I was thinking of parameters oversimplistically as just a canned-search-and-replace-text function or something like that.
Thanks again,
cdj

Similar Messages

  • I would like to set a block feature for Firefox Safe Mode. I can't figure out how to do this on McAffee. Help please.

    I found out that my boys can get into 'safe mode' which bypasses all blocks. I went to my McAfee home page and can't figure out how to block this browser. Can you tell me how??? THANKS!

    Create a contact for yourself either in the phone app or the contacts app. Then go - Settings > General > Siri > My Info > Set your contact.

  • I Cannot Figure Out How To Create A Signature Spot! Help Please!

    Hi,
    I'm not very good at all this stuff.  Long story short I have a contract drawn up that I need to use for doing business with my customers.  At the bottom I want to leave a box where they simply click when they're reading the PDF, and it allows them to draw in a signature.
    I first encountered this kind of thing on a W2 form, and it was so easy it worked without even pulling me off the browser.
    I have Acrobat Pro 10.1.1, but I simply cannot figure out how to do this.
    If anyone has the time, step-by-step instructions that a 6-year-old could follow is probably necessary with this.
    It would be so much appreciated.
    Thank you.
    -Robert

    It's possible that the W2 you used was set up with the EchoSign service. It allows you to draw a signature with a mouse. This is available as well with more recent versions of Reader (10.1+) if the form isn't Reader-enabled or secured. You will see this in the Sign panel when the document is opened in Reader.
    You can otherwise get an EchoSign account and upload your document and send it to your customers through the EchoSign service. You can establish a free account to see how it works.

  • I have a Macbook Pro and can't figure out how to change my password. Any help?

    This is  a password for like entering my compu

    Boot from your recovery partition by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the recovery desktop appears, select Utilities > Terminal from the menu bar.
    In the Terminal window, enter “resetpassword” (without the quotes) and press return. A “Reset Password” window opens.
    Select your boot volume if not already selected.
    Select your username from the menu labeled “Select the user account” if not already selected.
    Follow the prompts to reset the password.
    Select Apple menu > Restart from the menu bar.

  • Trying to enter hotel password and 1st letter is always upper case and password is lower case.  Can't figure out how to make 1st letter lower case

    I am trying to enter a hotel password for internet access.  The password is all lower case, but the 1st letter I type is always upper case and I can't figure out how to make it lower case.  Help?

    The digital keyboard on the iPad uses an "Up Arrow" as a symbol to represent its shift key(s). If it's highlighted, then the next letter typed will be upper-case. Just tap on the Arrow symbol and it should be unhighlighted. Now if you type any letter, it will be lower-case.

  • Can't figure out how to use home sharing

    Since the latest couple iTunes updates, my family and I can not figure out how to use home sharing. Everyone in our household has their own iTunes, and for a long time we would just share our music through home sharing. But with the updates, so much has changed that we can no longer figure out how to use it.
    I have a lot of purchased albums on another laptop in the house, that im trying to move it all over to my own iTunes, and I have spent a long time searching the internet, and everything. And I just can't figure out how to do it. So.... how does it work now? I would really like to get these albums from my moms iTunes, onto mine. I would hate to have to buy them all over again.
    If anyone is able to help me out here, that would be great! Thanks!

    The problem im having is that after I am in another library through home sharing, I can't figure out how to select an album and import it to my library. They used to have it set up so that you just highlight all of the songs you want, and then all you had to do was click import. Now I don't even see an import button, or anything else like it. So im lost... I don't know if it's something im doing wrong, or if our home sharing system just isn't working properly.
    Thanks for the help.

  • Something was hidden in a download and now these double green underlined hyperlinks show up everywhere, and pop ups too whenever I click on ANYTHING. I can't figure out how to find it and get rid of it.

    Something was hidden in a download and now these double green underlined hyperlinks show up everywhere, and pop ups too whenever I click on ANYTHING. I can't figure out how to find it and get rid of it.

    You installed the "DownLite" trojan, perhaps under a different name. Remove it as follows.
    Malware is constantly changing to get around the defenses against it. The instructions in this comment are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.vsearch.agent.plist
    Right-click or control-click the line and select
    Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item named "VSearch" selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.vsearch.daemon.plist
    /Library/LaunchDaemons/com.vsearch.helper.plist
    /Library/LaunchDaemons/Jack.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/VSearch
    /Library/PrivilegedHelperTools/Jack
    /System/Library/Frameworks/VSearch.framework
    Some of these items may be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
    From the Safari menu bar, select
    Safari ▹ Preferences... ▹ Extensions
    Uninstall any extensions you don't know you need, including any that have the word "Spigot" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
    This trojan is distributed on illegal websites that traffic in pirated movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect much worse to happen in the future.
    You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that the DownLite developer has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing, has not done so, even though it's aware of the problem. This failure of oversight is inexcusable and has compromised the value of Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • If I open a photo in "preview", multiple photos open. I just want to open one, but can't figure out how to do it.

    I keep multiple photos in a desktop folder to be quickly accessed by using Preview. But when I try to open ONE photo, it opens multiple photos. Can't figure out how to display just the single one that I select.  OS 10.7.2

    This is the resume feature of Lion. The last state of the application is saved when quitting (i.e last pictures viewed in Preview, last videos viewed in Quicktime etc).
    You can switch it off for Preview by copy and pasting the following in to the terminal application
    defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

  • How do I use my iPhone to connect to the Internet. I down loaded safari v5.1.7 for my PC. I have added my iPhone to my computer but I can't figure out how to setup a hotspot or configure a network so my PC can access my phones data plan. Please help.

    And how am I supposed to answer my own question?

    I can't figure out how to respond so ill go this route. I can't seem to find the button/place to which I can choose, to turn on a hot spot. I have been through every option and searched to no avail. Could it be that my iPhone 4 is not hotspot capable as I was led to believe by the apple sales associate? Is there an app I can find to make my phone a wifi hotspot? So I can get on the Internet to view the pages I want that require adobe which this piece of **** software monger won't even support?

  • How do I use GarageBand as a amp/speaker to listen to my Electronic Drum set? I have a MIDI-USB cord already but I can't figure out how to listen to my set through the software using my computer speakers?

    How do I use GarageBand as a amp/speaker to listen to my Electronic Drum set? I have a MIDI-USB cord already but I can't figure out how to listen to my set through the software using my computer speakers?

    If you want to listen to the sounds of your drum set, you should use an audio cable and connect it to the computer's line-in, then create a real instrument track.
    If you use a Midi/USB interface, you'll have to create a software instrument track and select one of GB's drumsets as the instrument. Hopefully your drumset's midi notes are mapped to the right sounds in GB.

  • I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    Edit > Preferences.  Select the check box for Ringtones, this will add them to the listing in iTunes. 
    Not sure that really answers your question though.

  • I am having trouble setting up icloud it keeps sending me back to install instructions and I'm just getting frustrated. So far I'm not liking the new itunes I can't figure out how to  look at my duplicate music like I used to.

    I can't sign on to icloud. It says I need an icloud account. I click the help option it send me back to the same page. I reinstall it nothing.
    Download the iCloud Control Panel.
    To enable iCloud on your Windows PC, first set up iCloud on your other devices, then install the iCloud Control Panel for Windows (Windows Vista with Service Pack 2 or Windows 7 required).
    ok I can't seem to set up iCloud on any device I don't understand... Ive already installed it three times.
    Turn on iCloud.
    From the Windows Start menu, choose iCloud Control Panel.
    Enter the Apple ID you used to create your iCloud account and select the iCloud services you’d like to enable.
    For mail, contacts, and calendars, you can use iCloud.com or Outlook 2007 or later.
    there is no iCloud control panel but I click on i cloud. Then entere the Apple ID you used to create your iCloud account - WHAT!!!!? where is this I keep trying to find out how to create and iCloud account but I keep getting these stupid directions!!!
    Enable automatic downloads.
    To enable automatic downloads for your music, apps, and books, open iTunes > Edit > Preferences > Store and select Music, Apps, and Books.* (Requires iTunes 10.5 or later.)
    - This is the only step that makes sense and already did it...
    Turn on iCloud for the rest of your devices.
    To get the most out of iCloud, set it up everywhere.
    This is soooo frustrating!!!!
    Also I want to be able to look at duplicate songs on my itunes but after I downloaded the new version I can not figure out how to get that back. If the duplicate setting isn't in the new itunes I want the old version back.

    Did you ever resolve the iCloud problem.I am in the same position and its driving me mad!!! If you have a link to an solution I would appreciate it.

  • I can't figure out how to import my native instruments into the library

    I'm trying to use Komplete 8 as a plug-in and I can't figure out how to put it in to library.

    Load the plugin into the insert, select your patch and then select "save as" from the channel strip menu.

  • I can't figure out how to sync my songs I downloaded to my itunes?

    I downloaded songs to itunes on my computer.  I can't figure out how to sync them to my ipod.  It says to click devices and pull up my ipod, but there is no "devices" listed, though I have registered, etc.?

    Connect your iPod to the computer with the provided cable.
    Open up iTunes.
    You should see your iPod in the Device list.
    Click on it.
    Choose what you want to sync to your iPod and then click Sync.

  • I can't figure out how to get my music to shuffle on my iPhone 5s. If I try to skip a song, it skips about 100 songs. It only ends up playing 4 or 5 songs then goes back to the song menu. Help please!

    I can't figure out how to get the music on my iPhone5s to shuffle. If I use the arrows to skip a song, it shuffles through a handful of the same songs then goes back to the song menu. Help please!

    Un-sync all your music to remove it from the device, then restart (hold down the home button along with the sleep/wake button until you see the apple, then let go). Now re-sync your music.

Maybe you are looking for