scripting@wanadoo.nl




DBExecuteSQL()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
13 May 2002 DBExecuteSQL()
AuthorJens Meyer (sealeopard@usa.net)
Action Executes a SQL command on a database.
SyntaxDBExecuteSQL (connection, SQL [,cmdType]) 
Parameters
  • connection (Required / String) open connection object to a data source
  • SQL (Required / String) SQL command to be executed
  • cmdType (Optional / Numeric) Optional integer defining the command type (e.g. SQL statement, stored procedure) 
  • RemarksThis routine does not return a recordset as the result of the SQL statement. Therefore, it should only be used with SQL commands like INSERT INTO, UPDATE. For SELECT statements one should rather use DBGetRecordset().

    KIXTART BBS http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000196 
    Returns0 if successful, otherwise error code 
    DependenciesKiXtart 4.02 (there have been reports of this function not working under KiXtart 4.10) 
    Examples
    $objConn = DBConnOpen('DRIVER={Microsoft Access Driver (*.mdb)}; UID=; PWD=; DBQ=database.mdb')
    $retcode = DBExecuteSQL($objConn,"INSERT INTO Demo(Field1,Field2) VALUES('Value1','Value2'")
    $retcode = DBConnClose($objConn)
    
     
    Source
    FUNCTION DBExecuteSQL ($objconn, $sql, OPTIONAL $cmdtype)
      DIM $cmdcommand, $rsrecordset
      DIM $adcmdunspecified, $adcmdtext, $adcmdtable, $adcmdstoredproc, $adcmdunknown, $adcmdfile, $adcmdtabledirect
    
      $adcmdunspecified = -1
      $adcmdtext        = 1
      $adcmdtable       = 2
      $adcmdstoredproc  = 4
      $adcmdunknown     = 8
      $adcmdfile        = 256
      $adcmdtabledirect = 512
    
      IF VarType($cmdtype)
        $cmdtype=Val($cmdtype)
      ELSE
        $cmdtype=$adcmdtext
      ENDIF
    
      IF VarType($objconn) <> 9 OR $sql = ''
        EXIT 87
      ENDIF
    
      $cmdcommand = CreateObject('ADODB.Command')
      IF @error
        EXIT @error
      ENDIF
      $cmdcommand.activeconnection = $objconn
      IF @error
        EXIT @error
      ENDIF
      $cmdcommand.commandtype = $cmdtype
      IF @error
        EXIT @error
      ENDIF
      $cmdcommand.commandtext = $sql
      IF @error
        EXIT @error
      ENDIF
    
      $rsrecordset=$cmdcommand.execute()
      $cmdcommand=''
      $rsrecordset=''
      IF @error
        EXIT @error
      ENDIF
    
      $dbexecutesql=@error
    ENDFUNCTION ; - DBExecuteSQL -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter