6 Replies Latest reply on Nov 20, 2012 10:12 PM by vilester

    Submiting form data to SQL server

    CilonS

      Hello!

       

      1st of all i'm new in livecycle and would like some advice:

       

      Im trying to save data from a livecycle form to a SQL server database.

       

      I made a simple example form with few fields, with no restrictions etc.

      I created a simple db with only 1 table with few fields, also with no restrictions.

      I created a data source in System DSN  with SQL Native Client driver named 'ControlConnection':

       

      Microsoft SQL Native Client Version 09.00.5000

       

      Data Source Name: ControlConnection
      Data Source Description: sql conection
      Server: EXCHANGE
      Use Integrated Security: No
      Database: Control
      Language: (Default)
      Data Encryption: No
      Trust Server Certificate: No
      Multiple Active Result Sets(MARS): No
      Mirror Server:
      Translate Character Data: Yes
      Log Long Running Queries: No
      Log Driver Statistics: No
      Use Regional Settings: No
      Use ANSI Quoted Identifiers: Yes
      Use ANSI Null, Paddings and Warnings: Yes

       

      Then i went in Livecycle Designer > Data View > New Data Connection and selected OLEDB Database named the new connection also 'ControlConnection'.

      In datalink properties selected Microsoft OLE DB Provider for ODBC Drivers, on datasource name selected the connection i've created before 'ControlConnection' , selected the table (named 'test') from the db and then bound the fields from the form to it.

      the submit button is set like this: Show: Click, Language: JavaScript, Run At: Client and the script is: xfa.sourceSet.test.addNew();

      Everything seems to work fine but when i go in preview and push the submit button i get this error:

       

      GeneralError: Operation failed.
      XFAObject.test:1:XFA:form1[0]:#subform[0]:Button1[0]:click
      Invalid property get operation; packet doesn't have property 'test'

       

      Where am i mistaking?

       

      Please help me!

        • 1. Re: Submiting form data to SQL server
          pguerett Level 6

          The code that opens the DB.....

           

          xfa.sourceSet.test.addNew();

           

          Instead of test in the call it shoudl be the name of your Data Connection that you created in Designer. Something like this:

           

          xfa.sourceSet.DataConnection.addNew()

           

          Hope that helps

           

          Paul

          • 2. Re: Submiting form data to SQL server
            CilonS Level 1

            Hello, and thank you for your answer!

             

            Indeed there was a mistake in typing the string name in the code, from some previous attempts.

             

            The connection string i have created in designer is named ControlConnection. I changed it but i get the same error.

             

            xfa.sourceSet.ControlConnection.addNew()

             

            and the error is:

             

            GeneralError: Operation failed.
            XFAObject.ControlConnection:1:XFA:form1[0]:#subform[0]:Button1[0]:click
            Invalid property get operation; packet doesn't have property 'ControlConnection'

             

            sample.jpg

             

            This must come from somewhere else

             

            The connection test to the database when i create the connection string is succesfull ...everything seems fine untill i push the button.

             

            Any other ideeas?

            • 3. Re: Submiting form data to SQL server
              pguerett Level 6

              But (according to the image) the Data Connection name is DataConnection2 not ControlConnection.

               

              Also can you try something else other than addNew? Use a Next or Previous function to move through records (I am trying to eliminate security issues and validate that the connection is working.

               

              You may also want to add an Open command before you do your command (to ensure that there is a connection to the DB).

               

              Paul

              • 4. Re: Submiting form data to SQL server
                CilonS Level 1

                I have tryied with next, previous, update etc...but everything gives the same error.

                 

                As for that image, i have added it later, so yeah the string was named bit different..sorry for the confusion.

                 

                Regarding Open command: could you be more specific how to use it in this case? because on adobe forums only xfa.sourceSet.DataConnection.first();(where only the DataConnection name has to be modified accordingly) seems to be enough.

                 

                The documentation that lead me to this is found here:

                http://help.adobe.com/en_US/livecycle/9.0/designerHelp/index.htm?content=000325.html

                 

                And stefan cameron's tutorials:

                http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/

                 

                Problem is that nowhere on the forums can i find this type of error i'm getting...it's like the program doesn't recognise the connection string i have created in it.


                Could this be from the drivers used to create the System DSN? (i have tryied with both SQL Server and SQL Native Client drivers, on remote and local server)

                But the connection tests work perfect..so i really have no clue what is happening.




                • 5. Re: Submiting form data to SQL server
                  pguerett Level 6

                  The error seems to indicate that the dataconnection name that you are using is not found .......so that is before the connnection to the server is even happening. I do not know why it is happening either .....can you send me the form and I will have a look. Send it to LiveCycle8@gmail.com and include a description of the issue in the email.

                   

                  Paul

                  1 person found this helpful
                  • 6. Re: Submiting form data to SQL server
                    vilester

                    Sorry for reviving this old thread, however I am having the exact same issue as OP and I still can't find any sort of solution on google or this website on this issue. I have even try using Microsoft Access as the Database by following the steps on this youtube video http://www.youtube.com/watch?v=C56_Cz-aE0c but I keep getting the same error? Can someone please help?