Hello my ND Forum pals,
in my application, I'm inserting some records into the database and giving the user an
option update those records at a later time.  The primary key for the record is Date.  
So
the database  won't let me insert anything with the same date.  Is there any way I can
write some Java Code and be able to update the record?
I enclose my code for inserting the records as it is now.  Your help will be really 
appreciated.
Thanks,
Rimma

//[[SPIDER_EVENT<Insert_onWebEvent>
public int Insert_onWebEvent(CSpWebEvent event)
        {
int command = PROCEED;
                
                CSpDBResult             resultSet               = null;
                CSpDBResultStatus       resultStatus    = null;
                
                Integer year = new Integer 
(getDisplayFieldValue("dfYear").stringValue().trim());
                Integer month = new Integer 
(getDisplayFieldValue("dfMonth").stringValue().trim());
                Integer day = new Integer 
(getDisplayFieldValue("dfDay").stringValue().trim());
                String date = new 
String(year.toString()+month.toString()+day.toString());
                CSpider.putUserSessionObject("sesDate", (CSpValue) new 
CSpString(date));
                
                String high52 = getDisplayFieldValue("df52High").stringValue().trim();
                CSpider.putUserSessionObject("ses52High", (CSpValue) new 
CSpString(high52));
                
                String low52 = getDisplayFieldValue("df52Low").stringValue().trim();
                CSpider.putUserSessionObject("ses52Low", (CSpValue) new 
CSpString(low52));
                
                String dataAsOf = 
getDisplayFieldValue("dfDataAsOf").stringValue().trim();
                CSpider.putUserSessionObject("sesDataAsOf", (CSpValue) new 
CSpString(dataAsOf));
                
                
                
                String sql = "INSERT INTO dataAndStockPrices ";
                sql = sql + "VALUES (";
                sql = sql + "'" + date + "'";
                sql = sql + ", " + day.intValue();
                sql = sql + ", " + month.intValue();
                sql = sql + ", " + year.intValue();
                sql = sql + ", '" + high52 + "'";
                sql = sql + ", '" + low52 + "'";
                sql = sql + ", '" + dataAsOf + "'";
                sql = sql + ")";

                resultSet = CSpDataObject.executeImmediate("dsDailyNews", sql);
                resultStatus = resultSet.getResultStatus();
                if (resultStatus.getVendorErrorCode1() == resultStatus.SUCCESS)
                {
                        CSpCommonPage pgTextInput = 
CSpider.getCommonPage("pgTextInput");
                        pgTextInput.load(false);
                        return(PROCEED);
                }
                else
                {
                        CSpCommonPage pgError = CSpider.getCommonPage("pgError");
                        pgError.setDisplayFieldValue("stMessage", new CSpString("This 
is an error associated
         w/ the 'DataObjectExecuteImmediate' method - SQL Error 
("+resultStatus.getVendorErrorCode1()+"):
         "+resultStatus.getVendorErrorMessage1()+".  Please contact the Internet 
Services
         Group for help."));
                        pgError.load(false);
                        return(STOP);
                }
                
        }
        //]]SPIDER_EVENT<Insert_onWebEvent>

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to