Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

SQL join help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: SQL join help

    Thanks all. Robert got it right - the table had a primary index that I was not filling. I broke through all sorts of barriers in understanding and working with SQL last night, so I think I'm on my way to some new stuff.

    BTW, I'm putting together a system that I would hope would be very portable to other databases, and provide a nice set of management tools for multiple languages for a site.
    -Steve
    sigpic

    Comment


      #17
      Re: SQL join help

      Continuing this conversation:

      I have this sql statement:

      Code:
      UPDATE lang_translation 
         SET lang_translation.translate = "test1"
       WHERE lang_translation.Translate_ID = "fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7"
      It works in Toad.

      The exact same code fails in the grid event (I'm also successfully using the same grid event to insert records).

      Here are some of the connection properties as shown in the A5 debugger:

      {Code=0,Text=Success,NativeCode=0,NativeText=,Syntax=,API=,RowsAffected=0,Success=.T.,Error=.F.,Canceled=.F.,Warnings=.F.}

      Yet the update fails.

      Any suggestions?
      -Steve
      sigpic

      Comment


        #18
        Re: SQL join help

        Steve...

        I've recently upgraded to the latest build and started getting the same error. In the build I was using the following worked on an AfterInsertRecord Event

        dim conn as SQL::Connection
        conn.open("::Name::arcapp")
        v1 = e.DataSubmitted.DD_CARRIER1
        v2 = e.datasubmitted.DD_CARRIER2
        v3 = e.datasubmitted.DD_LINK_FK
        v4 = e.datasubmitted.DD_CARRIER3
        v5 = e.datasubmitted.DEC_DATE1
        v6 = e.datasubmitted.DEC_DATE2
        v7 = e.datasubmitted.DEC_DATE3
        v8 = e.datasubmitted.DEC_BY1
        v9 = e.datasubmitted.DEC_BY2
        v10 = e.datasubmitted.DEC_BY3
        v11 = e.datasubmitted.Phone1
        v12 = e.datasubmitted.Phone2
        v13 = e.datasubmitted.Phone3
        v14 = e.datasubmitted.DEC_Reason1
        v15 = e.datasubmitted.DEC_Reason2
        v16 = e.datasubmitted.DEC_Reason3
        sqlstatement = "insert into due_diligence (DD_CARRIER1, DD_CARRIER2, DD_LINK, DD_CARRIER3, DEC_DATE1, DEC_DATE2, DEC_DATE3, DEC_BY1, DEC_BY2, DEC_BY3, PHONE1, PHONE2, PHONE3, DEC_REASON1, DEC_REASON2, DEC_REASON3) Values('"+v1+"', '"+v2+"', '"+v3+"', '"+V4+"', '"+V5+"', '"+V6+"', '"+V7+"', '"+V8+"', '"+V9+"', '"+V10+"', '"+V11+"', '"+V12+"', '"+v13+"', '"+V14+"', '"+V15+"', '"+V16+"')"
        conn.Execute(sqlstatement)
        conn.Close()
        end function

        I'm not sure if something changed in this build...I have to look at the release notes. BTW...my dB is MySQL.

        Joe
        Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

        Comment


          #19
          Re: SQL join help

          on exact same table name both fieldtypes char(40), trans_id = prim key
          towards a SQLSERVER

          UPDATE lang_translation
          SET translate = 'test1'
          WHERE (translate_id = 'fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7')

          the update is succesfull, [ change from " to ' ]

          Comment


            #20
            Re: SQL join help

            I'm working with MySQL like Joe.

            My Inserts using double quotes work fine.

            I tried changing the double quotes to single quotes as suggested by Eric, but got errors about that.

            So, no solution yet.
            -Steve
            sigpic

            Comment


              #21
              Re: SQL join help

              From release notes...not sure what we would need to change to make things work again...

              Version 10.5 - Build 2972_3565 Jun 30 2010
              Behavior Change

              MySQL - AlphaDAO - Update and Delete Statements - Call Result - Previously, with MySQL, when you executed an UPDATE or DELETE statement and there were no records that satisfied the WHERE clause in the statement, the call result was .T. (and AffectedRows was, of course, 0). This was inconsistent with all other Databases. Therefore, the behavior of MySQL has been changed so that it is consistent with all other Databases.

              Now, the call result if is .T. if matching records were found and the UPDATE or DELETE was executed. If no matching records were found, the call result is .F. and the error text is 'The database could not find the data you requested'.

              To differentiate between a 'critical' error (such as invalid column name, invalid table name, no open connection, etc.) and a 'benign' error (no records match the WHERE clause), you can look at the call result text.

              If the call result text starts with 'Database API specific error', the error is a 'critical' error. If the call result text is 'The database could not find the data you requested', then the error is simply that no records matched the WHERE clause.
              Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

              Comment


                #22
                Re: SQL join help

                In my first post about this particular problem, I didn't have a callresult error. Now I do:

                {Code=28,Text=Error parsing SQL statement�� ,NativeCode=51,NativeText=line 2:29: expecting A5SQLTOKEN_...


                Again, just trying to execute this:

                Code:
                	sqlStatement = <<%sql%
                	UPDATE lang_translation 
                	SET lang_translation.translate = "test8"
                	WHERE lang_translation.Translate_ID = "fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7"
                	%sql%
                -Steve
                sigpic

                Comment


                  #23
                  Re: SQL join help

                  Anyone have further thoughts on this update problem?
                  -Steve
                  sigpic

                  Comment


                    #24
                    Re: SQL join help

                    Steve,

                    I did try to duplicate your table, and the running of the SQL and didn't have a problem here.

                    However, I'm not 100% sure on the table setup - can you send me your table, and the component that you're running your script from? I'll take a quick look.

                    Thanks,

                    Robert
                    Earl Allin
                    REAInc.net

                    We can help you with mentoring and custom programming services in Alpha, .NET, React, PHP, ColdFusion, and more..

                    Comment


                      #25
                      Re: SQL join help

                      Everyone seems to agree that the SQL itself is OK - you have after all executed the code successfully directly on a SQL Server.
                      I haven't done any SQL calls from A5 so far, so not familiar with the <<%sql%......%sql "wrapper".
                      However, the error message doesn't look like an SQL error message, but more like an A5 message since it ends with "expecting A5SQLTOKEN_...". An SQL server would not be famliar with an A5SQLTOKEN... so it looks like it is an error detected in the A5 environment from which you are executing the script and the script isn't getting to the SQL server at all.
                      You could confirm that by running the MySQL Profiler which will show you all SQl statements which the server receives and executes.
                      HTH
                      -Rob

                      Comment


                        #26
                        Re: SQL join help

                        Figured out my SQL Update problem:

                        I was doing this, which worked in many places:

                        Code:
                        UPDATE lang_translation 
                           SET lang_translation.translate = 'test1'
                         WHERE lang_translation.Translate_ID = 'fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7'
                        But this is what works in the grid event:

                        Code:
                        UPDATE lang_translation 
                           SET translate = 'test1'
                         WHERE Translate_ID = 'fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7'
                        -Steve
                        sigpic

                        Comment


                          #27
                          Re: SQL join help

                          'Glad to here Steve its solved '.;)

                          Comment


                            #28
                            Re: SQL join help

                            Originally posted by Steve Workings View Post
                            Figured out my SQL Update problem:

                            I was doing this, which worked in many places:

                            Code:
                            UPDATE lang_translation 
                               SET lang_translation.translate = 'test1'
                             WHERE lang_translation.Translate_ID = 'fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7'
                            But this is what works in the grid event:

                            Code:
                            UPDATE lang_translation 
                               SET translate = 'test1'
                             WHERE Translate_ID = 'fbe8c0cb-2faa-4fdd-b6c0-1957d8a7cba7'
                            Steve, I know this is an old thread, but thanks for posting. This just solved the exact problem I was having.
                            I have been using the update code with the table name followed by period in your first example and it had been fine until now.
                            This time I was calling the xbasic function from server side event afterUpdateRecord and it kept failing until I removed the table name and period from in front of field names (thanks to your post... I would never have thought of that since it had been working elsewhere). It seems completely strange to me that the syntax would work in some places, but not others???? Is that an a5 bug or is it a matter of where the Xbasic code is called from?
                            Carol King
                            Developer of Custom Homebuilders' Solutions (CHS)
                            http://www.CHSBuilderSoftware.com

                            Comment


                              #29
                              Re: SQL join help

                              Just thought I'd share what Selwyn just told me about the above:

                              PER SELWYN: no, it is not a bug
                              since an update can by definition (at least in portable sql, and in most sql databases), only update a single column, it is not necessary to qualify the fields in the 'SET' clause.

                              it is OK, however, to qualify the fields in the WHERE clause if you want (although again, unnecessary in this case since there is only a single table and therefore there is no ambiguity).

                              note that if you turn portable sql off, your update will work
                              Carol King
                              Developer of Custom Homebuilders' Solutions (CHS)
                              http://www.CHSBuilderSoftware.com

                              Comment

                              Working...
                              X