Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Microsoft SQL Server Connect

All examples are included with download of MBS FileMaker Plugin.

Microsoft SQL Server Connect.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts4
Value Lists0
Custom Functions0
Custom Menus0
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Microsoft SQL Server Connect
1 field defined, 1 record
Microsoft SQL Server Connect

Fields

Table Name: Microsoft SQL Server Connect - 1 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
ResultNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German

      Layout Objects: Microsoft SQL Server Connect

      Regular Fields

      Field Name: Microsoft SQL Server Connect::Result
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 83 pt
      • Left: 86 pt
      • Bottom: 245 pt
      • Right: 601 pt
      • Anchoring: Left, Top
      Field Format:
      • Edit Box
      Field Behavior:
      • Allow field to be entered: In Find mode, In Browse mode
      • Touch keyboard type: Default for Data Type
      • Go to next field using: Tab key
      Yes

      Buttons

      Button PropertiesCoordinatesScript/Script Step
        Type:
      • Text: ODBC Datasource
      • Top: 263 pt
      • Left: 84 pt
      • Bottom: 292 pt
      • Right: 211 pt
      • Anchoring: Left, Top
      Perform Script [ “Connect via ODBC to DataSource” ]

      Scripts:


      Button PropertiesCoordinatesScript/Script Step
        Type:
      • Text: Native Driver
      • Top: 263 pt
      • Left: 222 pt
      • Bottom: 292 pt
      • Right: 349 pt
      • Anchoring: Left, Top
      Perform Script [ “Connect via SQLServer with native driver” ]

      Scripts:


      Button PropertiesCoordinatesScript/Script Step
        Type:
      • Text: OLEDB
      • Top: 263 pt
      • Left: 360 pt
      • Bottom: 292 pt
      • Right: 487 pt
      • Anchoring: Left, Top
      Perform Script [ “Connect via SQLServer with OLEDB” ]

      Scripts:


      Button PropertiesCoordinatesScript/Script Step
        Type:
      • Text: DB Library
      • Top: 263 pt
      • Left: 498 pt
      • Bottom: 292 pt
      • Right: 625 pt
      • Anchoring: Left, Top
      Perform Script [ “Connect via SQLServer with OLEDB” ]

      Scripts:


      Script Hierarchy

      Connect via ODBC to DataSource
      Connect via SQLServer with native driver
      Connect via SQLServer with OLEDB
      Connect via SQLServer with DB-Library

      Next Script: [Connect via SQLServer with native driver]
      Script NameConnect via ODBC to DataSource
      Run script with full access privilegesOff
      Include In MenuYes
      Layouts that use this script
      Scripts that use this script
        Script Definition
        Script Steps
        • Set Variable [ $r; Value:MBS("Trace") ]
        • Set Field [ Microsoft SQL Server Connect::Result; "" ]
        • Set Variable [ $Connection; Value:MBS("SQL.NewConnection") ]
        • #Tell plugin we want to use ODBC
        • Set Variable [ $result; Value:MBS("SQL.SetClient"; $Connection; "ODBC") ]
        • #Connect via data source
        • Set Variable [ $ConnectionString; Value:"test" ]
        • Set Variable [ $UserName; Value:"test" ]
        • Set Variable [ $Password; Value:"tester" ]
        • Set Variable [ $result; Value:MBS("SQL.Connect"; $Connection; $ConnectionString; $Username; $Password; "ODBC") ]
        • If [ $result ≠ "OK" ]
        • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
        • Set Variable [ $result; Value:MBS("SQL.FreeConnection"; $Connection) ]
        • Halt Script
        • End If
        • #Create select and run it
        • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT @@VERSION AS 'SQL Server Version';") ]
        • #Run it
        • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
        • If [ $result ≠ "OK" ]
        • Set Field [ Microsoft SQL Server Connect::Result; $result ]
        • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
        • Else
        • Set Variable [ $result; Value:MBS("SQL.FetchNext"; $Command) ]
        • Set Variable [ $v; Value:MBS("SQL.GetFieldAsText"; $command; 1) ]
        • Set Field [ Microsoft SQL Server Connect::Result; $v ]
        • End If
        • #Cleanup
        • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
        • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
        Fields used in this script
        Scripts used in this script
          Layouts used in this script
            Tables used in this script
            Table occurrences used by this script
            Custom Functions used by this script
              Custom menu set used by this script

                Previous Script: [Connect via ODBC to DataSource]Next Script: [Connect via SQLServer with OLEDB]
                Script NameConnect via SQLServer with native driver
                Run script with full access privilegesOff
                Include In MenuYes
                Layouts that use this script
                Scripts that use this script
                  Script Definition
                  Script Steps
                  • Set Variable [ $r; Value:MBS("Trace") ]
                  • Set Field [ Microsoft SQL Server Connect::Result; "" ]
                  • Set Variable [ $Connection; Value:MBS("SQL.NewConnection") ]
                  • #Tell plugin we want to use ODBC
                  • Set Variable [ $result; Value:MBS("SQL.SetClient"; $Connection; "SQLServer") ]
                  • #Connect via data source
                  • // Set Variable [ $ConnectionString; Value:"Windows7PC\SQLEXPRESS@test" ]
                  • #this is via SQLServer-ODBC or OLEDB. I had to open Firewall, put in right IP and assign ports to SQL Server for TCP/IP and enable TCP/IP access!
                  • Set Variable [ $ConnectionString; Value:"tcp:192.168.2.75\SQLEXPRESS,1433@test" ]
                  • Set Variable [ $UserName; Value:"test" ]
                  • Set Variable [ $Password; Value:"tester" ]
                  • Set Variable [ $result; Value:MBS("SQL.SetConnectionOption"; $Connection; "UseAPI"; "ODBC") ]
                  • Set Variable [ $result; Value:MBS("SQL.Connect"; $Connection; $ConnectionString; $Username; $Password; "SQLServer") ]
                  • If [ $result ≠ "OK" ]
                  • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                  • Set Variable [ $result; Value:MBS("SQL.FreeConnection"; $Connection) ]
                  • Halt Script
                  • End If
                  • #Create select and run it
                  • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT @@VERSION AS 'SQL Server Version';") ]
                  • #Run it
                  • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                  • If [ $result ≠ "OK" ]
                  • Set Field [ Microsoft SQL Server Connect::Result; $result ]
                  • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                  • Else
                  • Set Variable [ $result; Value:MBS("SQL.FetchNext"; $Command) ]
                  • Set Variable [ $v; Value:MBS("SQL.GetFieldAsText"; $command; 1) ]
                  • Set Field [ Microsoft SQL Server Connect::Result; $v ]
                  • End If
                  • #Cleanup
                  • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                  • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                  Fields used in this script
                  Scripts used in this script
                    Layouts used in this script
                      Tables used in this script
                      Table occurrences used by this script
                      Custom Functions used by this script
                        Custom menu set used by this script

                          Previous Script: [Connect via SQLServer with native driver]Next Script: [Connect via SQLServer with DB-Library]
                          Script NameConnect via SQLServer with OLEDB
                          Run script with full access privilegesOff
                          Include In MenuYes
                          Layouts that use this script
                          Scripts that use this script
                            Script Definition
                            Script Steps
                            • Set Variable [ $r; Value:MBS("Trace") ]
                            • Set Field [ Microsoft SQL Server Connect::Result; "" ]
                            • Set Variable [ $Connection; Value:MBS("SQL.NewConnection") ]
                            • #Tell plugin we want to use ODBC
                            • Set Variable [ $result; Value:MBS("SQL.SetClient"; $Connection; "SQLServer") ]
                            • #Connect via data source
                            • Set Variable [ $ConnectionString; Value:"Windows7PC\SQLEXPRESS@test" ]
                            • Set Variable [ $UserName; Value:"test" ]
                            • Set Variable [ $Password; Value:"tester" ]
                            • Set Variable [ $result; Value:MBS("SQL.SetConnectionOption"; $Connection; "UseAPI"; "OLEDB") ]
                            • Set Variable [ $result; Value:MBS("SQL.Connect"; $Connection; $ConnectionString; $Username; $Password; "SQLServer") ]
                            • If [ $result ≠ "OK" ]
                            • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                            • Set Variable [ $result; Value:MBS("SQL.FreeConnection"; $Connection) ]
                            • Halt Script
                            • End If
                            • #Create select and run it
                            • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT @@VERSION AS 'SQL Server Version';") ]
                            • #Run it
                            • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                            • If [ $result ≠ "OK" ]
                            • Set Field [ Microsoft SQL Server Connect::Result; $result ]
                            • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                            • Else
                            • Set Variable [ $result; Value:MBS("SQL.FetchNext"; $Command) ]
                            • Set Variable [ $v; Value:MBS("SQL.GetFieldAsText"; $command; 1) ]
                            • Set Field [ Microsoft SQL Server Connect::Result; $v ]
                            • End If
                            • #Cleanup
                            • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                            • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                            Fields used in this script
                            Scripts used in this script
                              Layouts used in this script
                                Tables used in this script
                                Table occurrences used by this script
                                Custom Functions used by this script
                                  Custom menu set used by this script

                                    Previous Script: [Connect via SQLServer with OLEDB]
                                    Script NameConnect via SQLServer with DB-Library
                                    Run script with full access privilegesOff
                                    Include In MenuYes
                                    Layouts that use this script
                                      Scripts that use this script
                                        Script Definition
                                        Script Steps
                                        • Set Variable [ $r; Value:MBS("Trace") ]
                                        • Set Field [ Microsoft SQL Server Connect::Result; "" ]
                                        • Set Variable [ $Connection; Value:MBS("SQL.NewConnection") ]
                                        • #Tell plugin we want to use ODBC
                                        • Set Variable [ $result; Value:MBS("SQL.SetClient"; $Connection; "SQLServer") ]
                                        • #Connect via data source
                                        • Set Variable [ $ConnectionString; Value:"Windows7PC\SQLEXPRESS@test" ]
                                        • Set Variable [ $UserName; Value:"test" ]
                                        • Set Variable [ $Password; Value:"tester" ]
                                        • Set Variable [ $result; Value:MBS("SQL.SetConnectionOption"; $Connection; "UseAPI"; "DB-Library") ]
                                        • Set Variable [ $result; Value:MBS("SQL.Connect"; $Connection; $ConnectionString; $Username; $Password; "SQLServer") ]
                                        • If [ $result ≠ "OK" ]
                                        • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                        • Set Variable [ $result; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                        • Halt Script
                                        • End If
                                        • #Create select and run it
                                        • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT @@VERSION AS 'SQL Server Version';") ]
                                        • #Run it
                                        • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                        • If [ $result ≠ "OK" ]
                                        • Set Field [ Microsoft SQL Server Connect::Result; $result ]
                                        • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                        • Else
                                        • Set Variable [ $result; Value:MBS("SQL.FetchNext"; $Command) ]
                                        • Set Variable [ $v; Value:MBS("SQL.GetFieldAsText"; $command; 1) ]
                                        • Set Field [ Microsoft SQL Server Connect::Result; $v ]
                                        • End If
                                        • #Cleanup
                                        • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                        • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                        Fields used in this script
                                        Scripts used in this script
                                          Layouts used in this script
                                            Tables used in this script
                                            Table occurrences used by this script
                                            Custom Functions used by this script
                                              Custom menu set used by this script

                                                Download example: Microsoft SQL Server Connect

                                                Used functions: