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

Video : Calling a SQL Server Stored Procedure with arguments

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

    Video : Calling a SQL Server Stored Procedure with arguments

    This is the first in a 2 video series that shows you how to call a SQL Server stored procedure with arguments passed from a Grid Component.

    http://www.screencast.com/t/ZfLFkxtADoHY

    I've covered the client side JavaScript, the server side XBasic and the T-SQL at the SQL Server.

    Files are in the link below:

    http://bit.ly/dQPdbu

    Video 2 should be completed later this evening.
    Bob Moore



    #2
    Re: Video : Calling a SQL Server Stored Procedure with arguments

    Here is a link to video 2 on calling a SQL stored procedure.

    Discusses another option for passing arguments from JavaScript to the XBasic callback function. Also includes a discussion of using Firebug for client side debugging of Ajax callbacks.

    http://www.screencast.com/t/XivGVdoGwb8F
    Bob Moore


    Comment


      #3
      Re: Video : Calling a SQL Server Stored Procedure with arguments

      I know this is a vague question, but, what might I be doing now that could better done in a stored procedure?
      Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

      Comment


        #4
        Re: Video : Calling a SQL Server Stored Procedure with arguments

        Here is a link to a revised grid that no longer uses the setTimeout() function in the row onclick event handler.

        I modified the code to pass the row number as a parameter to the called function.

        This is the recommended best practice.

        http://bit.ly/gmOwsL
        Bob Moore


        Comment


          #5
          Re: Video : Calling a SQL Server Stored Procedure with arguments

          That is very progressive work Bob. Thanks.
          Insanity: doing the same thing over and over again and expecting different results.
          Albert Einstein, (attributed)
          US (German-born) physicist (1879 - 1955)

          Comment


            #6
            Re: Video : Calling a SQL Server Stored Procedure with arguments

            I modified the code to pass the row number as a parameter to the called function.
            Technically this should read "I modified the code to pass the row number as an argument to the called function. "

            A parameter is the declaration in the function definition.
            Example :

            foo(x){
            alert(x);
            }

            x is a parameter, when I call foo('Cool') then 'Cool' is the argument.
            Bob Moore


            Comment


              #7
              Re: Video : Calling a SQL Server Stored Procedure with arguments

              Since no one responded to my very vague question I will try another. I have searched the internet to find the an answer but I still remain ignorant. I don't get the case for sql procedures.

              I have many grids in which I select from, insert into and update various MySql tables in xbasic events and callbacks. Since the xbasic code runs on the server it does not seem like there would be a speed boost. Since you can use arguments in alpha security is not an issue.

              Would it be beneficial to try to put those selects, inserts and updates into a stored procedure?

              It would be nice if someone who has experience with stored procedures would comment.
              Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

              Comment


                #8
                Re: Video : Calling a SQL Server Stored Procedure with arguments

                For my case, I code all business logic inside stored procedure.
                It is at database level. So, no matter the front-end tools change, the logic always the same.
                Moreover, it is easy to maintain integrity by using transaction inside the stored procedure.

                However, coding inside alpha's XBasic is still as good as stored procedure.
                It depends on your personal practise.
                Norman

                Comment


                  #9
                  Re: Video : Calling a SQL Server Stored Procedure with arguments

                  Thanks for you reply Norman. That is the same message I got from my searching the internet. Unless someone else has a more compeling reason I will stick with xbasic and what I know best for now.
                  Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                  Comment


                    #10
                    Re: Video : Calling a SQL Server Stored Procedure with arguments

                    Frank,

                    If your MySQL databases are like mine, the MySQL engine mostly sits idle while Alpha works hard. But I've started changing that to let MySQL share the load.

                    For example, I have a transaction history table, so I feed that table with a trigger from the insert and update events on the main table. Now, any grid that affects the main table gets the history without haveing to code it over and over for each grid.

                    I also have a client who needs lots of calculations involving multiple tables. In Alpha, I did that with arrays, and one session with one user would cause the size of Alpha to jump by 150k! So, I'm moving that into a stored procedure to ease the load on Alpha.

                    As I gain more experience with stored procedures, and they become easier and quicker for me to create, I'm sure there will be lots more use for these.

                    Pat
                    Pat Bremkamp
                    MindKicks Consulting

                    Comment


                      #11
                      Re: Video : Calling a SQL Server Stored Procedure with arguments

                      Thank you Pat,
                      Your message is well taken. As soon as I get this Alpha thing figured out (right), I will have to use the last brain cell I have left to try to learn sql procedures.
                      Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                      Comment


                        #12
                        Re: Video : Calling a SQL Server Stored Procedure with arguments

                        The reason I am using Stored Procedures and asked Bob to create this code is because we are dealing with millions of rows (> 10 gig) in a table. The stored procedure will do the calculating on the Server and then pass the results to the Alpha 5 grid.

                        I hope this helps.

                        Comment


                          #13
                          Re: Video : Calling a SQL Server Stored Procedure with arguments

                          Ok I couldn't resist. I found more information. I don't know why I was afraid. I guess because of the unknown. Stored procedures are easier than coding in alpha.

                          Someone famous once said "You have nothing to fear but fear itself"

                          These advantages along with everyones comments convinced me:

                          Stored Procedures Advantages
                          ■Stored procedure increases performance of application. Once created, stored procedure is compiled and stored in the database catalog. It runs faster than uncompiled SQL commands which are sent from application.
                          ■Stored procedure reduced the traffic between application and database server because instead of sending multiple uncompiled lengthy SQL commands statements, application only has to send the stored procedure name and get the data back to manipulate it futher.
                          ■Stored procedure is reusable and transparent to any application which wants to use it. Stored procedure exposes the database interface to all applications so developers don't have to program the functions which are already supported in stored procedure in all external applications.
                          ■Stored procedure is secured. Database administrator can grant the access right to application which wants to access stored procedures in database catalog without granting any permission on the underlying database tables.
                          Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

                          Comment


                            #14
                            Re: Video : Calling a SQL Server Stored Procedure with arguments

                            The argument against using stored procedures is that it locks you into a specific SQL vendor but if that is not a concern it offers many benefits, many of which have been previously discussed.

                            Another benefit is code management and widespread access to expert level SQL programmers for distribution of the programming load.

                            Last year I created a fairly complex web based financial application for a customer that had access to a programmer that knew SQL stored procedures quite well but didn't have any experience with Alpha Five, Xbasic or JavaScript.

                            I coded as much of the business and transaction logic into SQL stored procedures. This allowed the SQL programmer to easily identify and modify the code as required. It is now also helping to distribute the workload for the customer.

                            It turned out to be a complex application that is not only fast and reliable but also easy to maintain and modify.

                            I think it is a good strategy.
                            Bob Moore


                            Comment


                              #15
                              Re: Video : Calling a SQL Server Stored Procedure with arguments

                              Bob,

                              Is it a recommended practice to use the setTimeout() function for onclick events ? I'm a little confused by your video. Would it also be needed for the onclick event of a button or a field?

                              Thanks
                              Frank

                              Tell me and I'll forget; show me and I may remember; involve me and I'll understand

                              Comment

                              Working...
                              X