📘
TimeLine E3
  • TimeLine E3 Documentation
  • Framework
    • Introduction
    • DataSet Definition
    • Window Handling Object
      • Input/Output arguments
      • Open
      • BindDataControls
      • Item Changes
      • Item Search
      • MenuItemClicked
      • Print
      • ModuleOpened (BlueArrow)
      • BlueArrowArguments
      • New Row
      • Delete Row
      • Save
      • Transactions
      • Locking [deprecated]
      • Locking (new)
      • Resizing a response window
      • ParaPanel
      • Adding DMS Tab to a Module
    • BusinessObject
    • Controls
      • BindingFormat
      • LookupGrid and SearchDef
      • ComboBox
      • RadioButton
      • Multiline Textbox
      • xTextBoxSearch
      • xFileBrowse [v16+]
      • DxDispoColumn
      • DxProgressColumn
      • DxTemplateColumn
      • Change control caption programmatically
      • TabControl
      • Navigation
      • Enable controls programmatically
      • Enable a MenuItem programmatically
      • Filter search values
      • Jumping to another module
      • Messages, Notifications, Log, Exceptions, Translation
      • LoggerSink [deprecated]
      • Log
      • OpenFile, FolderBrowsing and SaveFile
      • Execute Actions while displaying an Hourglass
      • Using Progress
      • Async methods with progress bar
      • Wizard
      • Customizing controls using xBehaviors
      • TLProperty.AllowInReadOnly [v16+]
    • DataSet Operations
    • Business-related functionality
      • Getting the next primary key
      • Hybrids
      • Enums
      • Get Current User
    • SQL
    • SQL (using named parameters)
    • Advanced SQL
    • Expression Binding
    • Server-side logic & customization [v16+]
      • Service Hoster
      • Starting / stopping hosted services
      • Changes to scheduled jobs!
      • Business Object Proxies
      • Business Object API
    • Colors in Expression Bindings [v15+]
    • Theming
      • Icons
  • TimeLine Developer (TLD)
    • Debugging in TLD
    • Targets
    • Custom Project Rework [v16+]
  • TimeLine-specific LL functions
  • Stunnel proxy
    • Pre-requisites
    • 1. Initial setup
    • 2. Generate the server/web certificates
    • 3.a. Generating client certificates using the CSR flow
    • 3.b. Generate client certificates from the server console
    • 4. Setting up the E3 client connection
    • 5. Setting up the browser certificates
  • Configuration
    • Configuring the WCF timeout
  • Troubleshooting the E3 Bridge
  • [Deprecated]
    • TimeLine WEB - deprecated in v16+
      • Prerequisites for running the WASM modules on the server
      • Prerequisites for developing WASM modules with TLD
      • Creating a small web module with TLD
      • Terminal Configuration
    • Customization Examples - deprecated in v16+
    • Codestore [deprecated]
    • Configuring the scheduled jobs timeout - deprecated in v16+
Powered by GitBook
On this page
  • SelectValue
  • SelectRow
  • SelectTable
  • TrySelectValue
  • Methods interrogating the db
  1. Framework

SQL

PreviousGet Current UserNextSQL (using named parameters)

Last updated 3 years ago

Please take into consideration using instead of the formatted strings as in the examples below.

SelectValue

Read a single Value from the DataBase. If no value could be found, the NoSqlResultException is thrown. If more than one value is found, the InvalidOperationException is thrown.

int max = Sql.SelectValue("SELECT  MAX(nr)  FROM  versand_vorschlag ").ToInt(0);

SelectRow

Selects multiple values from the DataBase. All values have the same where-clause. Returns NULL if no result is found.

var resultRow = Sql.SelectRow(
    "Select lager_nr, bestand from bestand where lager_nr = {0} and art_nr = '{1}'",
    versandRow.lager_nr, versandRow.artnr);

SelectTable

Select multiple values and rows from the DataBase. Returns NULL if no rows are found.

DataTable resultRows = Sql.SelectTable(
    "Select lager_nr, lagerort, charge, seriennr, bestand, fifodatum from bestand_detail where lager_nr = {0} and art_nr = '{1}'",
     versandRow.lager_nr, versandRow.artnr);

TrySelectValue

Read a single Value from the DataBase.

No exceptions are thrown but the results are returned in the ret variable.

Attention! ret corresponds to the number of rows found (usually 1=ok). It is NOT the SQL returncode, where 0 stands for ok.

var hasSerChr = Sql.TrySelectValue(out ret, 
    "Select lagerdetail from art where artnr = '{0}'", 
    versandRow.artnr).ToInt(0);

Methods interrogating the db

public virtual int GetMitarbKuerzel(string currentMitarb)
{
    //Method used for getting the Employee Abbreviation
    return Sql.TrySelectValue("SELECT kuerzel FROM mitarb JOIN users ON mitarb.user_id = users.id WHERE mitarb.kuerzel = '{0}'", currentMitarb).ToStringNN();
}

Named Parameters
SQL (using named parameters)