Results 1 to 3 of 3

Thread: [RESOLVED] syntax issue with sql statement..driving me nuts

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Resolved [RESOLVED] syntax issue with sql statement..driving me nuts

    I am using a inline sql statement to update a table (in oracle).

    Some how this statement doesn't run.

    sUpdateStatement = "UPDATE AUTOTRADE.RATE_ADVANCES SET TREASURY_RATE = '" + dLiveBM + "'";

    OracleConnection _oOracleConnection = new OracleConnection(sConnectionstring);

    _oOracleConnection.Open();

    OracleCommand _oOracleCommand = new OracleCommand(sUpdateStatement, _oOracleConnection);

    _oOracleCommand.CommandText = sUpdateStatement;

    try
    {
    //code hangs here . no output at all. I don't know whats going on.
    //the sUpdateStatement has the following sql statement.
    //"UPDATE AUTOTRADE.RATE_ADVANCES SET TREASURY_RATE = '5.04'"
    _oOracleCommand.ExecuteNonQuery();
    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.ToString());
    }

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    Re: syntax issue with sql statement..driving me nuts

    I am using a inline sql statement to update a table (in oracle).

    Some how this statement doesn't run.

    Code:
    sUpdateStatement = "UPDATE AUTOTRADE.RATE_ADVANCES SET TREASURY_RATE = '" + dLiveBM + "'";
    
    OracleConnection _oOracleConnection = new OracleConnection(sConnectionstring);
    
    _oOracleConnection.Open();
    
    OracleCommand _oOracleCommand = new OracleCommand(sUpdateStatement, _oOracleConnection);
    
    _oOracleCommand.CommandText = sUpdateStatement;
    
    try
    {
              //code hangs here . no output at all. I don't know whats going on.
             //the sUpdateStatement has the following sql statement.
             //"UPDATE AUTOTRADE.RATE_ADVANCES SET TREASURY_RATE = '5.04'"
            _oOracleCommand.ExecuteNonQuery();
     }
    catch (Exception ex)
    {
           Console.WriteLine(ex.ToString());
    }

  3. #3
    Addicted Member MasterBlaster's Avatar
    Join Date
    Jul 2002
    Location
    Seattle
    Posts
    196

    Re: [RESOLVED] syntax issue with sql statement..driving me nuts

    Quote Originally Posted by bnathvbdotnet
    I am using a inline sql statement to update a table (in oracle).
    So, you like to open you database up to SQL injection attacks then? Hever heard of a parameterized query or stored procedure? It will sollve you syntax error and keep you database secure.
    "And most of the evils of society can, in fact, be cured through information. We have a society that has been disinformed and based on the disinformation has made irrational choices. And that's what I mean by 'ignorance.' People, who ordinarily might be smart, are deprived of the data by which to make a rational decision, don't have the data to do it."
    Frank Zappa

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width