Insert into - problem

I have a problem while executing an insert-statement from an ASP-script.
The problem is, that a statement like :
Insert into test(test1,test2) values('testing','testagain')
inserts 2 identical records instead of just 1
I'm working with Oracle 8i on win98
Any solutions ?
Jesper

Hi,
You please check the asp code whether the insert is inside a loop. Check whether are you calling the form again. You please check whether are you doing refresh for the same form.
These are the possible places where these type of problem may occur.
bye

Similar Messages

  • Problem while inserting into a table which has ManyToOne relation

    Problem while inserting into a table *(Files)* which has ManyToOne relation with another table *(Folder)* involving a attribute both in primary key as well as in foreign key in JPA 1.0.
    Relevent Code
    Entities:
    public class Files implements Serializable {
    @EmbeddedId
    protected FilesPK filesPK;
    private String filename;
    @JoinColumns({
    @JoinColumn(name = "folder_id", referencedColumnName = "folder_id"),
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Folders folders;
    public class FilesPK implements Serializable {
    private int fileId;
    private int uid;
    public class Folders implements Serializable {
    @EmbeddedId
    protected FoldersPK foldersPK;
    private String folderName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "folders")
    private Collection<Files> filesCollection;
    @JoinColumn(name = "uid", referencedColumnName = "uid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Users users;
    public class FoldersPK implements Serializable {
    private int folderId;
    private int uid;
    public class Users implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer uid;
    private String username;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
    private Collection<Folders> foldersCollection;
    I left out @Basic & @Column annotations for sake of less code.
    EJB method
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    FoldersPK folderPk = new FoldersPK(folderID, uid);
         // My understanding that it should automatically handle folderId in files table,
    // but it is not…
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    It is giving error:
    Internal Exception: java.sql.SQLException: Field 'folderid' doesn't have a default value_
    Error Code: 1364
    Call: INSERT INTO files (filename, uid, fileid) VALUES (?, ?, ?)_
    _       bind => [hello.txt, 1, 0]_
    It is not even considering folderId while inserting into db.
    However it works fine when I add folderId variable in Files entity and changed insertFile like this:
    public void insertFile(String fileName, int folderID, int uid){
    FilesPK pk = new FilesPK();
    pk.setUid(uid);
    Files file = new Files();
    file.setFilename(fileName);
    file.setFilesPK(pk);
    file.setFolderId(folderId) // added line
    FoldersPK folderPk = new FoldersPK(folderID, uid);
    file.setFolders(em.find(Folders.class, folderPk));
    em.persist(file);
    My question is that is this behavior expected or it is a bug.
    Is it required to add "column_name" variable separately even when an entity has reference to ManyToOne mapping foreign Entity ?
    I used Mysql 5.1 for database, then generate entities using toplink, JPA 1.0, glassfish v2.1.
    I've also tested this using eclipselink and got same error.
    Please provide some pointers.
    Thanks

    Hello,
    What version of EclipseLink did you try? This looks like bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=280436 that was fixed in EclipseLink 2.0, so please try a later version.
    You can also try working around the problem by making both fields writable through the reference mapping.
    Best Regards,
    Chris

  • A problem with inserting into DB hebrew strings

    Hi,
    I am working with a 8.1.7 DB version, and use thin driver.
    I have my DB Charest configured to iso 8859P8 (which is visual Hebrew)
    I have no problem in making a connection and retrieving strings, using SELECT * FROM ..
    and then use the ResultSet.getString(String columnName) method .
    I also have no problem in inserting the Hebrew characters , and retrieving them back ( I represent them in a servlet ),
    The only problem I do have, is when I try to insert into DB a row in the following manner
    INSERT into table_name values( Hebrew_String_value1, Hebrew_String_value2, Hebrew_String_value3, Hebrew_String_value4)
    the insertion works fine , but somehow the insertion misplaces the strings order and actually the insertion is in opposite order :
    Hebrew_String_value4, Hebrew_String_value3, Hebrew_String_value2, Hebrew_String_value1.
    If I use the same insert with English Strings , there is no problem.
    does any one have the solution how I insert the strings in the right order ?
    one solution I have is to insert only one column and then update the table for each column , but then , instead of one execute() action , I have to make ,
    1 execute() + 9 executeUpdate() for a 10 column table

    Can you try specify the column order in your INSERT statement, i.e.
    INSERT INTO mytable( column1_name,
                         column2_name,
                         column3_name,
                         column4_name )
                 VALUES( column1_string,
                         column2_string,
                         column3_string,
                         column4_string)My wild guess, though I can't understand why at the moment, is that there may be a problem because Hebrew is read from right to left, that may be causing a problem.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Insert into with problems

    Hy,
    i have a little question. Try this:
    create table strangetab (
    id varchar2(20),
    textfield varchar2(200)
    CREATE OR REPLACE PROCEDURE writestrangetab
    id VARCHAR2,
    textfield varchar2 default null)
    IS
    pragma autonomous_transaction;
    BEGIN
    INSERT INTO strangetab
    (id, textfield
    ) VALUES
    (id, textfield
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
    rollback;
    END;
    After table and procedure creation, try to run this script (simple insert into in autonompus_transaction):
    set serveroutput on
    declare
    vstr varchar2(10000);
    begin
    for i in 1..2000
    loop
    vstr := vstr||'r';
    end loop;
    dbms_output.put_line('write a');
    writestrangetab( 'idx' , 'a');
    dbms_output.put_line('write big string');
    writestrangetab( 'idx' , vstr);
    dbms_output.put_line('write b');
    writestrangetab('idx' , 'b');
    end;
    The script generate this output:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    write a
    write big string
    ORA-12899: value too large for column "STRANGETAB"."TEXTFIELD" (actual:
    2000, maximum: 200)
    write b
    As i expect, the second write goes wrong but first and third no and it put string a and b into srangetable.
    Now try to run this:
    set serveroutput on
    declare
    vstr varchar2(10000);
    begin
    for i in 1..5000
    loop
    vstr := vstr||'r';
    end loop;
    dbms_output.put_line('write a');
    writestrangetab( 'idx' , 'a');
    dbms_output.put_line('write big string');
    writestrangetab( 'idx' , vstr);
    dbms_output.put_line('write b');
    writestrangetab('idx' , 'b');
    end;
    The only difference from the previous is the vstr dimension: first 2000 now 5000.
    In my db (10.2.0.4 on linux) the output of this, is:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    write a
    write big string
    ORA-01461: can bind a LONG value only for insert into a LONG column
    write b
    ORA-01001: invalid cursor
    If i query the strangetable i am non able to find string b (Only string a was registered)!
    As if that were not enough, If you try to insert others writestrangetab, anything after wath that produce the error will be stored!
    It is normal?
    By
    Stefano

    Tanks for your reply Jhon, but:
    1) "The second run you are trying to pass 5000 characters to a varchar, which caused your error when trying to call your procedure"
    Why you say "which caused". When i call a procedure can't pass more than 4000 Chars? I know that pl/sql varchar2 is up to 32000 Chars even in procedure calls!
    2) "That is why your cursor because invalid"
    Witch cursor? The strange thing is that there isn't any cursor in the autonomous procedure! The anly statement is an insert into!
    The problem of the second miss in the second run is ok: that wont register the string. The main problem is the miss of the third in the seconf run.
    Why it not register the third writestrangetab? In that case i pass only a 'b' char. Writestarngetab Is an autonomous transaction so i expect a miss if it fail, but the next, if ok, will be registerd. why not?
    By
    Stefano

  • Problem in Insertion into table through After Report Parameter form trigger

    Hi All,
    I am getting problem in inserting some data into temp table through Report.
    My requirement is like that, I have to do a calculation based on user parameters, and then insert the data into the temp table. I wanted to do this into After Report Parameter form trigger function. I have done all the calculation and wrote all the insert statement in that function. There is no problem in compilation. then I am taking value from this temp table in my formula columns.
    When I run this report, it hangs, don't understand what is the problem.Can anybody help me out in this.
    Thanks,
    Nidhi

    The code is as follows:
    function AfterPForm return boolean is
    CURSOR CUR_RECEIPT(RECEIPT_NUM_FROM NUMBER, RECEIPT_NUM_TO NUMBER) IS
    SELECT DISTINCT receipt, item_no FROM xxeeg.xxeeg_1229_sp_putaway WHERE RECEIPT BETWEEN
    RECEIPT_NUM_FROM AND RECEIPT_NUM_TO ;
    V_CUR_RECEIPT CUR_RECEIPT%ROWTYPE;
    begin
    OPEN CUR_RECEIPT(:RECEIPT_NUM_FROM, :RECEIPT_NUM_TO);
    FETCH CUR_RECEIPT
    INTO V_CUR_RECEIPT;
    LOOP
    EXIT WHEN CUR_RECEIPT%NOTFOUND;
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST1' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 12
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 13
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 14
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST2' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 16
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 17
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 18
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 19
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 20
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 21
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    END IF;
    END IF;
    END LOOP;
    COMMIT;
    CLOSE CUR_RECEIPT;
    return(TRUE);
    end;
    .....................................................................................................................

  • Weird problem w. mysql 4.0 when inserting  into a table with auto_incremet

    Since I upgraded my mysql database from 3.23 to 4.0.1
    the following code does not work anymore:
    I get this error msg:
    <b>"Invalid argument value: Duplicate entry '2147483647' for key 1"</b>
    <code>
    package mysql4test;
    import java.sql.*;
    class test {
    public test() {
    public static void main(String[] args) {
    Connection connection = null;
    Statement st = null;
    try {
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    connection = DriverManager.getConnection
    ("jdbc:mysql://192.168.0.4/x?user=x&password=");
    st = connection.createStatement();
    for (int i=1;i<10;i++)
    String insert = "insert into x (b) values('hello');";
    System.out.println(insert);
    st.executeUpdate(insert);
    } catch (Exception ex) { System.err.println(ex.getMessage());}
    </code>
    The table definition of table x is the following:
    create table x(a int(11) primary key auto_increment, b varchar(10));
    What makes the thing even more mysterious is, that doing the same thing as this programm does manually on an mysql client does not produces any error message.
    insert into x (b) values('hello'); works fine on the mysql client deliverd with the server.

    Hi eggsurplus!
    Yes, I succeeded in different ways to solve the problem. changing the table was one of it. but the problem is that i can't simply change all tables (there are a lot) as the are used in other programms.
    The simplest solution that i figured out so far was changing the insert from
    insert into x (b) values('hello')
    to
    insert into x (a,b) values("+i+",'hello')"
    But this solution is still not satisfactory as in more complex programs you can't just use the i variable of the for loop, but you have to add a new variable that increments on every insert.
    This still means changing a lot of code that i wrote for mysql 3.x.
    Besides, i tried also another jdbc driver and it still didn't work.
    The same bug was reported in a PHP forum, but without solution

  • Quite complext problem - INSERT into PAYMENTS

    I am trying to use the following code to insert data into the payments table. The code does work, the user is prompted for the order number (3 times - but this is ok). The fnext time this code is used the order number previously entered is used again without the user being prompted. This assignment is due in next week so any help would be great. The code is:
    INSERT into Payments values(Payments_seq.nextval, '&order_no', initcap('&Payment_Method'),
    (select sum(order_details.cost) from order_details WHERE '&order_no' = order_details.order_no),
    (select (orders.date_of_order+7) FROM orders where '&order_no' = orders.order_no), &Amount_Paid);
    The table we want to enter details is called 'payments' but we want details taken from order_details which is another table.
    Pam

    Use "&&order_no" to prevent re-prompting.
    Use "UNDEFINE order_no" to unset the variable.
    btw the problem would seem to be to do with setting and clearing SQL*Plus substitution variables, and nothing to do with inserting, payments tables or query complexity.

  • Problem inserting record using INSERT INTO

    I am an amateur web builder using some ColdFusion functionality to access information on an Access database. I know very little about ColdFusion syntax, but I'm using Dreamweaver CS3 to help generate most of the code. I'm working on an insert record page to create a user database with login information. I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
    Syntax error in INSERT INTO statement.
    The error occurred in C:\ColdFusion9\wwwroot\Everett\register.cfm: line 22
    Below is the entire page with line 22 (referenced in the error message) in red. Any ideas?
    <cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "register">
      <cfquery datasource="everettweb">  
        INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
    VALUES (<cfif IsDefined("FORM.first_name") AND #FORM.first_name# NEQ "">
    <cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.last_name") AND #FORM.last_name# NEQ "">
    <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.email") AND #FORM.email# NEQ "">
    <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.password") AND #FORM.password# NEQ "">
    <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
      </cfquery>
      <cflocation url="register_success.cfm">
    </cfif>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <link href="main.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Everett Music Department, Everett, MA</title>
    <!-- InstanceEndEditable -->
    <style type="text/css">
    <!--
    body {
    background-color: #660000;
    -->
    </style>
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    //-->
    </script>
    <!-- InstanceBeginEditable name="head" -->
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
    <!-- InstanceEndEditable -->
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    a:link {
    color: #660000;
    a:visited {
    color: #A01D22;
    a:hover {
    color: #FFCC00;
    -->
    </style>
    <link href="main.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="MM_preloadImages('menu_about_over','menu_ensembles_over.jpg','menu_schools_over.j pg','menu_events_over.jpg','menu_faculty_over.jpg','menu_contacts_over.jpg','menu_home_ove r.jpg','menu_about_over.jpg','menu_links_over.jpg','menu_login_over.jpg')">
    <table width="960" align="center" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="3"><img src="top_border.jpg" width="960" height="20" align="top" /></td>
      </tr>
      <tr align="center">
        <td colspan="3"><a href="index.php"><img src="e_oval_top.jpg" height="100" width="270" border="0" /></a><a href="index.php"><img src="header.jpg" height="100" width="690" border="0" /></a></td>
      </tr>
      <tr>
        <td height="35" width="301"><a href="index.php"><img src="e_oval_bottom.jpg" height="35" width="234" border="0" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','menu_home_over.jpg',1)"><img src="menu_home.jpg" width="67" height="35" name="home" border="0" id="home" /></a></td>
        <td width="251"><ul id="MenuBar1" class="MenuBarHorizontal">
          <li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about','','menu_about_over.jpg',1)"><img src="menu_about.jpg" width="71" height="35" name="about" border="0" id="about" /></a>
            <ul>
              <li><a href="#">News</a></li>
              <li><a href="#">History</a></li>
              <li><a href="#">Media</a></li>
            </ul>
          </li>
          <li><a class="MenuBarHorizontal" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('ensembles','','menu_ensembles_over.jpg',1)"><img src="menu_ensembles.jpg" width="98" height="35" name="ensembles" border="0" id="ensembles" /></a>
            <ul>
              <li><a href="#">Band</a></li>
              <li><a href="#">Chorus</a></li>
              <li><a href="#">Strings</a></li>
            </ul>
          </li>
          <li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('schools','','menu_schools_over.jpg',1)"><img src="menu_schools.jpg" width="82" height="35" name="schools" border="0" id="schools" /></a>
            <ul>
              <li><a href="#">Everett High School</a></li>
              <li><a href="#">English School</a></li>
              <li><a href="#">Keverian School</a></li>
              <li><a href="#">Lafayette School</a></li>
              <li><a href="#">Parlin School</a></li>
              <li><a href="#">Webster School</a></li>
              <li><a href="#">Whittier School</a></li>
            </ul>
          </li>
        </ul>
        </td>
               <td width="408"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('events','','menu_events_over.jpg',1)"><img src="menu_events.jpg" width="74" height="35" name="events" border="0" id="events" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('faculty','','menu_faculty_over.jpg',1)"><img src="menu_faculty.jpg" width="79" height="35" name="faculty" border="0" id="faculty" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','menu_links_over.jpg',1)"><img src="menu_links.jpg" width="66" height="35" name="links" border="0" id="links" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('login','','menu_login_over.jpg',1)"><img src="menu_login.jpg" name="login" width="69" height="35" border="0" id="login" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','menu_contact_over.jpg',1)"><img src="menu_contact.jpg" width="100" height="35" name="contact" border="0" id="contact" /></a><img src="menu_spacer_end.jpg" width="20" height="35" /></td>
      </tr>
      <tr height="10">
        <td colspan="3"><img src="menu_bottom_spacer.jpg" height="10" width="960" /></td>
      </tr>
    </table>
    <table width="960" cellpadding="0" cellspacing="0" align="center">
      <tr height="50">
        <td width="30" background="left_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
        <td width="900" bgcolor="#FFFFFF">
          <table width="900" cellpadding="0" cellspacing="0">
            <tr>
              <td width="900" height="350" valign="top"><!-- InstanceBeginEditable name="PageBody" -->
          <form action="<cfoutput>#CurrentPage#</cfoutput>" method="POST" name="register" preloader="no" id="register">
                <table width="100%">
                  <tr>
                    <td colspan="2" class="heading1">Fill in the information below to register for this site:</td>
                  </tr>
                  <tr>
                    <td colspan="2"><img src="clear.gif" height="15" /></td>
                  </tr>
                  <tr>
                    <td width="50%" class="form" align="right">First Name:</td>
                    <td width="50%"><span id="sprytextfield1">
                      <input type="text" name="first_name" required="yes" id="first_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Last Name:</td>
                    <td><span id="sprytextfield2">
                      <input type="text" name="last_name" required="yes" id="last_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Email Address:</td>
                    <td><span id="sprytextfield3">
                    <input type="text" name="email" validate="email" required="yes" id="email" width="150" typeahead="no" showautosuggestloadingicon="true" />
                    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Confirm Email Address:</td>
                    <td><span id="sprytextfield4"><span id="ConfirmWidget">
                    <input type="text" name="email_confirm" validate="email" required="yes" id="email_confirm" width="150" typeahead="no" showautosuggestloadingicon="true" />
                    <span class="confirmInvalidMsg">The values do not match</span></span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Password:</td>
                    <td><span id="sprytextfield5">
                      <input type="password" name="password" required="yes" id="password" width="150" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Confirm Password:</td>
                    <td><span id="sprytextfield6"><span id="ConfirmWidget">
                      <input type="password" name="password_confirm" required="yes" id="password_confirm" width="150" />
                      <span class="confirmInvalidMsg">The values do not match</span></span></span></td>
                  </tr>
                  <tr>
                    <td> </td>
                    <td><input name="submit" type="submit" id="submit" value="Register" /></td>
                  </tr>
                </table>
          <input type="hidden" name="MM_InsertRecord" value="register" />
          </form>
          <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "email");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "email");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
    //-->
    </script>
    <script type="text/javascript">
    var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield4", "email");
    var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield6", "password");
    </script>
              <!-- InstanceEndEditable --></td>
            </tr>
          </table>
        </td>
        <td width="30" background="right_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
      </tr>
      <tr>
        <td colspan="3" background="footer.jpg" class="footer" height="80"/>This website best viewed using:<br /><a href="http://www.firefox.com"><img src="firefox_logo.gif" width="110" height="40" border="0" /></a></td>
      </tr>
    </table>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    <!-- InstanceEnd --></html>

    Syntax error in INSERT INTO statement.  INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
    That oh-so-uninformative error is because "Password" is a reserved word with your database driver.  Either escape it by putting square brackets around it too, or rename the column permanently. It is best to avoid using reserved words whenever possible. So renaming the column is the better option.  Also, I would try and avoid using invalid characters like spaces in column names ie "First Name". It is technically allowed, but it requires special handling everywhere which adds unecessary complexity.
    I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
    Do not take the error line numbers as gospel. Sometimes they just indicate that the error is within the vincinty of that line.
    I'm using Dreamweaver CS3 to help generate most of the code
    Unforutnately, DW wizards generate some truly awful and verbose code.  To give you an idea, here is what the query should look like, without all the wizard nonsense.
      <cfparam name="FORM.first_name" default="">
      <cfparam name="FORM.last_name" default="">
      <cfparam name="FORM.email" default="">
      <cfparam name="FORM.FORM.password" default="">
      <cfquery datasource="YourDSNName"> 
        INSERT INTO Users ([First Name], [Last Name], [Email Address], [Password])
        VALUES (
          <cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_varchar">
      </cfquery>
    CF is pretty easy to learn. You might want to begin perusing the CF documentation and a few tutorials to get more familiar with the language. Since you are working with a database, I would also recommend a  SQL tutorial.

  • Problem inserting into tables

    Hello All, I hope that someone out there may be able to shed some light on my problem!!
    I have developed a series of JSP pages for my web site (using Tomcat 4.1)to allow a Customer to register themselves with the site. I have developed 3 corresponding JavaBeans to hold the details that the customer enters; a Customer bean, an Address bean and a Payment bean. In my database (MySQL) i have tables corresponding to each of these beans, which simply take the data inserted into a field by the user and create a new instance of each.
    Now, the above is all working fine and the database tables populate themselves exactly as they should; however, to allow a customer to add more than one address, or more than one payment method, I have developed the relationship tables 'hasaddress' and 'haspaymentdetails' to store the relevant id numbers in the database (i.e. hasaddress stores a customerid from the customer bean and an addressid from the address bean).
    Finally, i get round to my question!!..
    I am using the following jsp code to insert data into one such table:
    <------------------------------------------------------------------->
    <jsp:useBean id="registration" class="projectBeans.RegistrationBean" scope="session"/>
    //set the connection
    registration.setConnection(c);
    //retrieve the customer attribute
    projectBeans.Customer customer = (projectBeans.Customer)session.getAttribute("newCust");
    //retrieve the address attribute
    projectBeans.AddressBean address = (projectBeans.AddressBean)session.getAttribute("newAddr");
    //use the addCustomer method in the bean to create a new customer     
    registration.addCustomer(customer);
    //ditto for address
    registration.addAddressDetails(address);
    //populate the hasaddress table with the correct ids
    String table = "hasaddress";
    int customerid = customer.getCustomerId();
    int addressid = address.getAddressId();
    registration.updateRelationship(table, customerid, addressid);Both the addCustomer and addAddressDetail methods work fine, so below is just the code for updateRelationship method in the registrationBean:
    public void updateRelationship(String table, int id1, int id2) throws SQLException
       sta = c.prepareStatement("INSERT INTO "+table +" VALUES(?,?)");
       sta.setInt(1, id1);
       sta.setInt(2, id2);
       sta.executeUpdate();
    }I would expect this method to retrieve the newly assigned customer and address ids and enter them into the hasaddress table; however, when the page compiles and i look at the table it enters 0 for each of the fields (when it should, for example be entering 14 and 16):
    ----------+
    | cid | aid |
    ----------+
    | 0 | 0 |
    ----------+
    so my question is: does anyone have an idea as to why this is happening, or what may be wrong with my code for this to occur?
    Alternatively, am i being dumb and is there some way of getting MySql to handle the updates to the relationship table internally?
    Thanks in advance for any ideas,
    Cheers

    Try to specify you database field as SQL need field names to do updating
    sta = c.prepareStatement("INSERT INTO "+table + "("+ id1+","+id2+ ")"+ VALUES(?,?)");

  • Problem inserting into access database.

    I am using the following code to create a table and insert values into an access database. Problem is that it only inserts the first 3 values no matter what order they are in. Any help is appreciated, and thanks in advance.
          stmt.executeUpdate("CREATE TABLE HardDrive (HardDriveID VARCHAR(10),"           + " HardDriveName VARCHAR(30), HardDriveSize VARCHAR(6), Price CURRENCY)");       stmt.executeUpdate("INSERT INTO HardDrive VALUES ('WD3000HLFS','Western Digital VelociRaptor','300 GB',229.99)");       stmt.executeUpdate("INSERT INTO HardDrive VALUES ('ST31000528AS','Seagate Barracuda','1 TB',99.99)");       stmt.executeUpdate("INSERT INTO HardDrive VALUES ('ST3250310AS','Seagate Barracuda','250 GB',47.99)");       stmt.executeUpdate("INSERT INTO HardDrive VALUES ('WD10EADS','Western Digital Caviar Green','1 TB',89.99)");

    What did I tell you about not using Access?
    This is exactly why. This is an Access related issue, and one that has been discussed many times previously on this site.
    Choose. Another. Database.

  • T-SQL - PL/SQL conversion: insert into ... select problem

    Hi!
    If I have an insert into ... select statement in T-SQL without a 'from' clause:
    bq. insert into sometable (foo, bar) \\ select 5, case when @bar=5 then 4 else 3 end
    its translation is:
    bq. INSERT INTO sometable \\ ( foo, bar ) \\ VALUES ( 5, CASE \\ WHEN 5 = 5 THEN 4 \\ ELSE 3 \\ END col );
    and I got: ORA-00917: "missing comma" for that. I'm not sure if it's a bug in the migration code, or is there a trick so that I can use 'CASE' in an insert into .. values statement somehow?
    Zoli

    You have to remove the column name. I just simplified your test case to check and it's working:
    CREATE TABLE test(
      id NUMBER
    INSERT
      INTO test(id)
      VALUES(CASE WHEN 5=5 THEN 4 ELSE 3 END)
    SELECT *
      FROM test
    ;C.

  • Problem with using INSERT INTO script

    Hi guys,
    I was trying to duplicate a table with the following script:
    CREATE TABLE TAB3(
    KEYATTR     NUMBER(3)     NOT NULL,
    BODY1     CHAR(1000)     NOT NULL,
    BODY2      CHAR(1000)     NOT NULL,
    BODY3     CHAR(1000)     NOT NULL,
         CONSTRAINT TAB3_PKEY PRIMARY KEY(KEYATTR) )
    INSERT INTO TAB3
         SELECT      *           
         FROM system.table3
         ORDER BY DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID) DESC, KEYATTR DESC
    However, when I execute the script, I keep getting a 'missing right parenthesis' error. Any idea what went wrong?

    You don't need braces.
    Just
    INSERT INTO TAB3
    SELECT *
    FROM system.table3
    ORDER BY DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID) DESC, KEYATTR DESCshould work.

  • File to RFC problem- data is not inserting into ztable in R3 system

    Hi
    i have done File to RFC scenario which picks data from flat file and inserts into ztable via RFC in R3. but while testing my scenario everything is successful in XI monitoring (Successful flag in MONI and RWB) and in auditlog message status is DLVD.
    it seems to be everything successful in XI and RFC call also successful in R3 system.
    but for some reason data is not inserting into table (RFC is used to insert data into ztable)
    Is there any way to debug RFC call excecution in XI..?
    RFC code is like this:
    insert ZMM_AUTO_GR from INPUT_TABLE.
    commit work.
    END FUNCTION.
    please advice what could be the reason not inserting into table.
    Help would be appreciated.
    Regards,
    Rajesh

    Hi Praveen,
    please see audit log- from communication channel monitoring..
    Receiver channel 'CC_INCA_RFC_SAPECC_Receiver' for party '', service 'R3DCLNT210' (internal name 'RfcClient[CC_INCA_RFC_SAPECC_Receiver]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=210, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=jsaha, jco.client.sysnr=00, jco.client.ashost=ausr3devdc02}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=210, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=jsaha, jco.client.sysnr=00, jco.client.ashost=ausr3devdc02}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2008-07-28 04:32:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 04:31:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:56:56 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:49:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:48:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA

  • How to repeated insert into history by textchanged event problem

    Hi guys i have 3 textboxes 1,2,3
    textbox1 respresent mobileNo
    textbox2 represent email
    textbox3 represent roomno
    I need to update any textboxes from three based on textchanged event
    Suppose i need update room no in textbox3 changed event
    room no is 22 i need to changed to 3333 then update in history by insert into statment in textchanged event
    it make insert 4 times 
    first time 3
    second time 33
    third time 333
    four time 3333
    how to prevent repeated insert into changes to history

    public void UpdateMobileHistory(string ConnectionString,string SerialNo ,string EmployeeNo, string Mobile,string UserID,string DateEdit)
    SqlConnection con = new SqlConnection(ConnectionString);
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = con;
    cmd.CommandType = CommandType.Text;
    cmd.CommandText = "insert into  dbo.HistoryEmployee values(@SerialNo,@EmployeeNo ,'Contact Data',@DateEdit,@UserID,@Mobile,null,null)";
    cmd.Parameters.Add("@SerialNo", SqlDbType.NVarChar, 20);
    cmd.Parameters.Add("@EmployeeNo", SqlDbType.NVarChar ,20);
    cmd.Parameters.Add("@Mobile", SqlDbType.NVarChar, 50);
    cmd.Parameters.Add("@UserID", SqlDbType.NVarChar ,20);
    cmd.Parameters.Add("@DateEdit", SqlDbType.NVarChar ,50);
    cmd.Parameters["@SerialNo"].Value = SerialNo;
    cmd.Parameters["@EmployeeNo"].Value = EmployeeNo;
    cmd.Parameters["@Mobile"].Value = Mobile;
    cmd.Parameters["@UserID"].Value = UserID;
    cmd.Parameters["@DateEdit"].Value = DateEdit;
    con.Open();
    cmd.ExecuteNonQuery();
    con.Close();
    public string MaxHistoryEmployee(string ConnectionString)
    SqlConnection con = new SqlConnection(ConnectionString);
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = con;
    cmd.CommandType = CommandType.Text;
    cmd.CommandText = "select max(SerialNo)+1 from dbo.HistoryEmployee";
    con.Open();
    string commit = Convert.ToString(cmd.ExecuteScalar());
    con.Close();
    return commit;
    private void textBox1_TextChanged(object sender, EventArgs e)
    FleetManagment.Fleet fleetContact1 = new FleetManagment.Fleet();
    string ID = fleetContact1.MaxHistoryEmployee("Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "");
    fleetContact1.UpdateMobileHistory("Data Source=" + value1 + ";Initial Catalog=" + value2 + ";User ID=" + value3 + ";Password=" + value4 + "",ID ,textBox4.Text, textBox1.Text,label6.Text,label10.Text);
    this is all my code

  • Problem Inserting into object view with OracleXmlSave

    Gurus,
    I'm trying to insert into an object view with
    multiple collections of objects representing a master/detail relationship and a CLOB column, but I've this error:
    oracle.xml.sql.OracleXMLSQLException: Error Interno
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1967)
    at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1060)
    at onix.interface_isbn.OnixXmlLoader.doInsert(OnixXmlLoader.java:165)
    at onix.interface_isbn.OnixXmlLoader.setLoader(OnixXmlLoader.java, Compiled Code)
    at onix.interface_isbn.OnixXmlLoader.<init>(OnixXmlLoader.java:23)
    at onix.interface_isbn.correrLoader.main(correrLoader.java:77)
    I'm using OracleXmlSave with insertXML method to do this.
    Is There any limitations to do that? (example
    number of tables into the view, columns datatype).
    I'd appreciate any comments
    Thank

    No known limitations. Please post the sample DDL to create your object types and object view, along with an example of the example XML document you're trying to insert.

Maybe you are looking for

  • Same Valuation class with diff valuation group with same valauation area

    Dear Expert, We r having two material XYZ and ABC with same valuation class and in the same plant(valuation Area) For consumption VBR general modifier we want to assign two different gl codes to different material XYZ & ABC. Is it possible in OMWD ca

  • Lotus Notes and Java

    hi there, any idea to open lotus notes create email with a specified attachment(by path or some other way) with button click on an interface(JSP)

  • Getting the error from icp report

    i am looking to take the icp report but getting below error An error has occurred. Please contact your administrator. Show Details: Error Number:70 Error Description:Permission denied Error Source:Microsoft VBScript runtime error Page On which Error

  • Upgrading to cs5 on a mac from cs2 on a pc

    Does anyone know if this possible? I've currently got cs2 installed on my PC and I'm buying an iMac in the new year and want to install and upgrade to cs5? Is that possible or will I have to buy the full version again?. Thanks in advance!

  • Organizing your own videos into the TV Show Category on the ipod

    I have a bit of a complicated problem. I want to organize some of my own videos onto the ipod under the TV Show section, NOT in the movie section. I have purchased tv shows from itunes, so that section is on my ipod. I've tried a million things, but