
TheLuBu
Members-
Posts
5 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
TheLuBu's Achievements

Seeker (1/7)
2
Reputation
-
Hi there, I used ISN Studio for a while and the startup sequence fascinated me, so i created a UDF for an easier handling of the Logo Creation. Till know, there are no Bugs or Errors, but there´s one thing you have to consider. You can´t use the color #FFFFFE for the Label, because #FFFFFE ist set to transparency in the Logo GUI. #include-once #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Global Const $AC_SRC_ALPHA = 1 Global $__gImageStartup_Logo Global $__gPNG_Logo Global $__gGUI_Controls_Logo Global $__gProgress_Logo Global $__gProgress_Label_Logo Global $__gFailure_Logo = False ; #FUNCTION# ;=============================================================================== ; ; Name...........: _Logo_Startup ; Description ...: Startup Logo Creation ; Syntax.........: _Logo_Startup($s_path, $iP_Left, $iP_Top, $iP_Width, $iP_Height, $iL_Left, $iL_Top, $iL_Width, $iL_Height, $f_GDIP = True, $i_Fade = 10) ; Parameters ....: $s_path - Path to PNG File ; $iP_Left - Progressbar Left Position ; $iP_Top - Progressbar Top Position ; $iP_Width - Progressbar Width ; $iP_Height - Progressbar Height ; $iL_Left - Label Left Position ; $iL_Top - Label Top Position ; $iL_Width - Label Width ; $iL_Height - Label Height ; $f_GDIP - Should GDI+ be loaded (Standard = True) ; $i_Fade - Speed of Logo to Fade in (Standard = 10) ; Return values .: Success - Return 1 ; Failure - Returns 0 and Sets @Error: ; |1 - Invalid $s_path (Not a PNG File) ; |2 - Invalid Number (@extended for Wrong Number) ; |3 - Invalid $s_path (Image could not be loaded) ; Author ........: TheLuBu (LuBu@veytal.com) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ; ;========================================================================================== Func _Logo_Startup($s_path, $iP_Left, $iP_Top, $iP_Width, $iP_Height, $iL_Left, $iL_Top, $iL_Width, $iL_Height, $f_GDIP = True, $i_Fade = 10) If Not StringRight($s_path, 4) = ".png" Then $__gFailure_Logo = True Return SetError(1, 0, 0) EndIf Local $ai_Positions[9] $ai_Positions[0] = $iP_Left $ai_Positions[1] = $iP_Top $ai_Positions[2] = $iP_Width $ai_Positions[3] = $iP_Height $ai_Positions[4] = $iL_Left $ai_Positions[5] = $iL_Top $ai_Positions[6] = $iL_Width $ai_Positions[7] = $iL_Height $ai_Positions[8] = $i_Fade For $i = 0 To 8 If Not StringIsDigit($ai_Positions[$i]) Then $__gFailure_Logo = True Return SetError(2, $i + 1, 0) EndIf Next $ai_Positions = "" Local $i_width, $i_height, $i_alpha If $f_GDIP = True Then _GDIPlus_Startup() EndIf $__gImageStartup_Logo = _GDIPlus_ImageLoadFromFile($s_path) If @error Then $__gFailure_Logo = True If $f_GDIP = True Then _GDIPlus_Shutdown() EndIf Return SetError(3, 0, 0) EndIf $i_width = _GDIPlus_ImageGetWidth($__gImageStartup_Logo) $i_height = _GDIPlus_ImageGetHeight($__gImageStartup_Logo) $__gPNG_Logo = GUICreate("", $i_width, $i_height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW)) __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, 0) GUISetState() WinSetOnTop($__gPNG_Logo, "", 1) $__gGUI_Controls_Logo = GUICreate("", $i_width, $i_height, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD, $WS_EX_TOOLWINDOW), $__gPNG_Logo) GUISetBkColor(0xFFFFFE) _WinAPI_SetLayeredWindowAttributes($__gGUI_Controls_Logo, 0xFFFFFE) $__gProgress_Logo = GUICtrlCreateProgress($iP_Left, $iP_Top, $iP_Width, $iP_Height) $__gProgress_Label_Logo = GUICtrlCreateLabel("", $iL_Left, $iL_Top, $iL_Width, $iL_Height, 1, -1) $i_alpha = 0 While 1 $i_alpha += $i_Fade If $i_alpha > 255 Then $i_alpha = 255 ExitLoop EndIf __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, $i_alpha) Sleep(10) WEnd __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, 255) GUISetState(@SW_SHOW, $__gGUI_Controls_Logo) Return 1 EndFunc ;==>_Logo_Startup ; #FUNCTION# ;=============================================================================== ; ; Name...........: _Logo_Set_Label_Font ; Description ...: Sets Font and Color for Logo Label ; Syntax.........: _Logo_Set_Label_Font($iSize = 8.5, $iWeight = 800, $iAttribute = 0, $sFontName = "Arial", $sHexcolor = 0x000000) ; Parameters ....: $iSize - Font Size (see GUICtrlSetFont) ; $iWeight - Font Weight (see GUICtrlSetFont) ; $iAttribute - Font Attributes (see GUICtrlSetFont) ; $sFontName - Font Name (see GUICtrlSetFont) ; $sHexcolor - Font Color (see GUICtrlSetColor) ; Return values .: Success - Return 1 ; Failure - Returns 0 and Sets @Error: ; |0 - _Logo_Startup failed ; |1 - Invalid $iWeight (Not a Number) ; |2 - Invalid $iAttribute (Not a Number) ; |3 - Invalid $sFontName (Not a Number) ; |4 - Invalid $iSize (Not a Number) ; Author ........: TheLuBu (LuBu@veytal.com) ; Modified.......: ; Remarks .......: ; Related .......:GUICtrlSetColor, GUICtrlSetFont ; Link ..........: ; ; ;========================================================================================== Func _Logo_Set_Label_Font($iSize = 8.5, $iWeight = 800, $iAttribute = 0, $sFontName = "Arial", $sHexcolor = 0x000000) If $__gFailure_Logo = True Then Return 0 If Not StringIsDigit($iWeight) Then Return SetError(1, 0, 0) If Not StringIsDigit($iAttribute) Then Return SetError(2, 0, 0) If Not StringIsXDigit($sHexcolor) Then Return SetError(3, 0, 0) If Not StringIsDigit($iSize) AND not StringIsFloat($iSize) Then Return SetError(4,0,0) GUICtrlSetFont($__gProgress_Label_Logo, $iSize, $iWeight, $iAttribute, $sFontName) GUICtrlSetColor($__gProgress_Label_Logo, $sHexcolor) Return 1 EndFunc ;==>_Logo_Set_Label_Font ; #FUNCTION# ;=============================================================================== ; ; Name...........: _Logo_Set_Data ; Description ...: Sets Label Data And/Or Progress Data ; Syntax.........: _Logo_Set_Data($i_Progress_Set = False, $s_Label_Set = False) ; Parameters ....: $i_Progress_Set - Font Size (see GUICtrlSetFont) ; $s_Label_Set - Font Weight (see GUICtrlSetFont) ; Return values .: Success - Return 1 ; Failure - Returns 0 and Sets @Error: ; |0 - _Logo_Startup failed ; |1 - Invalid $i_Progress_Set (Not a Number) ; |2 - Invalid $i_Progress_Set (Out of Range (0-100)) ; Author ........: TheLuBu (LuBu@veytal.com) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ; ;========================================================================================== Func _Logo_Set_Data($i_Progress_Set = False, $s_Label_Set = False) If $__gFailure_Logo = True Then Return 0 If $i_Progress_Set <> False Then If Not StringIsDigit($i_Progress_Set) AND NOT StringIsFloat($i_Progress_Set) Then Return SetError(1,0,0) If $i_Progress_Set < 0 Or $i_Progress_Set > 100 Then Return SetError(2, 0, 0) GUICtrlSetData($__gProgress_Logo, $i_Progress_Set) EndIf If $s_Label_Set <> False Then GUICtrlSetData($__gProgress_Label_Logo, $s_Label_Set) EndIf Return 1 EndFunc ;==>_Logo_Set_Data ; #FUNCTION# ;=============================================================================== ; ; Name...........: _Logo_Shutdown ; Description ...: Shutdown Logo and release Data ; Syntax.........: _Logo_Shutdown($f_Shutdown_GDIP = True, $i_Fade_Out = 15) ; Parameters ....: $f_Shutdown_GDIP - Shutdown GDI+ ; $i_Fade_Out - Speed of Logo to Fade out ; Return values .: Success - Return 1 ; Failure - Returns 0 and Sets @Error: ; |0 - _Logo_Startup failed ; |1 - Invalid $i_Fade_Out (Not a Number) ; Author ........: TheLuBu (LuBu@veytal.com) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ; ;========================================================================================== Func _Logo_Shutdown($f_Shutdown_GDIP = True, $i_Fade_Out = 15) If $__gFailure_Logo = True Then Return 0 If Not StringIsDigit($i_Fade_Out) Then Return SetError(1,0,0) Local $i_alpha = 255 While 1 $i_alpha = $i_alpha - $i_Fade_Out If $i_alpha <= 0 Then $i_alpha = 0 ExitLoop EndIf __Logo_SetBitmap($__gPNG_Logo, $__gImageStartup_Logo, $i_alpha) Sleep(10) WEnd GUIDelete($__gGUI_Controls_Logo) GUIDelete($__gImageStartup_Logo) If $f_Shutdown_GDIP = True Then _GDIPlus_Shutdown() EndIf Return 1 EndFunc ;==>_Logo_Shutdown ; #INTERNAL FUNCTION# ;====================================================================== ; ; Name...........: __Logo_SetBitmap ; Description ...: Sets transparency of an GUI Background ; Syntax.........: __Logo_SetBitmap($hGui, $hImage, $iOpacity) ; Parameters ....: $hGui - GUI to set transparency ; $hImage - Image to set transparency ; $iOpacity - Transparency to set (0-255) ; Return values .: Success - Return 1 ; Author ........: Unknown ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; ; ;========================================================================================== Func __Logo_SetBitmap($hGui, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGui, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) Return 1 EndFunc ;==>__Logo_SetBitmap #include <Logo_UDF.au3> $s_path = @ScriptDir & "\testlogo.png" $t = _Logo_Startup($s_path, 250, 220, 100, 10, 100, 182, 430, 25, True, 3) _Logo_Set_Label_Font() Sleep(1000) _Logo_Set_Data(50, "Autoit") SLeep(1000) _Logo_Set_Label_Font(8.5,800, 0, "Arial", 0xCE0000) SLeep(1000) _Logo_Set_Label_Font(8.5,800, 2, "Arial", 0xFF0000) Sleep(1000) _Logo_Set_Label_Font(8.5,800, 6, "Arial", 0xFFFF00) Sleep(1000) _Logo_Set_Data(80, "TheLuBu") Sleep(1000) _Logo_Set_Label_Font(8.5,800, 8, "Arial", 0xFFFFFF) _Logo_Set_Data(80) Sleep(1000) _Logo_Set_Data(False, "Logo UDF") Sleep(2000) AutoIT Test Logo comes from Cacgolf Inspiration is from ISN AutoIT Studio by ISI360 Logo.zip
-
I´ve seen the UDF from ChrisL but i missed some Functions like Create a Table or Column without using the complete SQL Query. For sure, it is great to use with MSDE, but i needed a UDF for MSSQL only, so i created it myself TheLuBu
-
Example Script #include <MSSQL.au3> #include <Array.au3> #Region Arrays and Values Dim $TestArray1 [10] $TestArray1[1] = "VALUE1" $TestArray1[2] = "Value2" $TestArray1[3] = "Value3" $TestArray1[4] = "Value4" $TestArray1[5] = "Value5" $TestArray1[6] = "Value6" $TestArray1[7] = "Value7" $TestArray1[8] = "Value8" $TestArray1[9] = "123456789" $TestValue = "Value15" $UNIQUEValue = "Value15" Dim $Testarray1D [10] $Testarray1D [1] = "Column1" $Testarray1D [2] = "Column2" $Testarray1D [3] = "Column3" $Testarray1D [4] = "Column4" $Testarray1D [5] = "Column5" $Testarray1D [6] = "Column6" $Testarray1D [7] = "Column7" $Testarray1D [8] = "Column8" $Testarray1D [9] = "Column9" Dim $Testarray2D [10][2] $Testarray2D [1][0] = "Column1" $Testarray2D [2][0] = "Column2" $Testarray2D [3][0] = "Column3" $Testarray2D [4][0] = "Column4" $Testarray2D [5][0] = "Column5" $Testarray2D [6][0] = "Column6" $Testarray2D [7][0] = "Column7" $Testarray2D [8][0] = "Column8" $Testarray2D [9][0] = "INT_Column" $Testarray2D [1][1] = "VARCHAR(45)" $Testarray2D [2][1] = "VARCHAR(60)" $Testarray2D [3][1] = "VARCHAR(75)" $Testarray2D [4][1] = "VARCHAR(40)" $Testarray2D [5][1] = "VARCHAR(20)" $Testarray2D [6][1] = "VARCHAR(17)" $Testarray2D [7][1] = "VARCHAR(52)" $Testarray2D [8][1] = "VARCHAR(100)" $Testarray2D [9][1] = "INT" Dim $AddArray2D [3][10] $AddArray2D [1][1] = "Row 1 Column 1" $AddArray2D [1][2] = "Row 1 Column 2" $AddArray2D [1][3] = "Row 1 Column 3" $AddArray2D [1][4] = "Row 1 Column 4" $AddArray2D [1][5] = "Row 1 Column 5" $AddArray2D [1][6] = "Row 1 Column 6" $AddArray2D [1][7] = "Row 1 Column 7" $AddArray2D [1][8] = "Row 1 Column 8" $AddArray2D [1][9] = "111111111" $AddArray2D [2][1] = "Row 2 Column 1" $AddArray2D [2][2] = "Row 2 Column 2" $AddArray2D [2][3] = "Row 2 Column 3" $AddArray2D [2][4] = "Row 2 Column 4" $AddArray2D [2][5] = "Row 2 Column 5" $AddArray2D [2][6] = "Row 2 Column 6" $AddArray2D [2][7] = "Row 2 Column 7" $AddArray2D [2][8] = "Row 2 Column 8" $AddArray2D [2][9] = "222222222" #EndRegion $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $sqlCon = _MSSQL_Con("IP", "USER", "PASS", "DATABASE") _MSSQL_CreateTable($sqlCon, "TestTable") _MSSQL_CreateColumn($sqlCon, "TestTable", "TestColumn VARCHAR(150)") For $i = 1 To UBound($TestArray1) - 1 _MSSQL_AddRecord($sqlCon, "TestTable", "'"&$TestArray1[$i]&"'") Next $UNIQUESHOW = _MSSQL_AddRecord($sqlCon, "TestTable", "'Value8'", TRUE, "WHERE TestColumn = 'Value8'") If @error = 3 Then MsgBox(16, "Error", "Value8 already exist in Table TestTable, Column TestColum") $Table = _MSSQL_CreateTable($sqlCon, "TestTable") If @error = 2 Then MsgBox(16, "Error", "Table Already exists") MSgbox(0, "Lets have a look", "Take a look at your database before you click OK") $DeleteTable = _MSSQL_DropTable($sqlCon, "TestTable") If $DeleteTable = 1 Then MsgBox(48, "Success", "TestTable was dropped") _MSSQL_CreateTable($sqlCon, "TestTable1DArray") $CreateColumn1D = _MSSQL_CreateColumn($sqlCon, "TestTable1DArray", $Testarray1D) _MSSQL_AddRecord($sqlCon, "TestTable1DArray", $TestArray1) _MSSQL_CreateTable($sqlCon, "TestTable2DArray") $CreateColumn1D = _MSSQL_CreateColumn($sqlCon, "TestTable2DArray", $Testarray2D) _MSSQL_AddRecord($sqlCon, "TestTable2DArray", $TestArray1) MSgbox(0, "Lets have a look", "Take a look at your database before you click OK") $DeleteTable = _MSSQL_DropTable($sqlCon, "TestTable1DArray") If $DeleteTable = 1 Then MsgBox(48, "Success", "TestTable was dropped") _MSSQL_AddRecord($sqlCon, "TestTable2DArray", $AddArray2D) $getrecord = _MSSQL_GetRecord($sqlCon, "TestTable2DArray") _arrayDisplay ($getrecord) $DeleteTable = _MSSQL_DropTable($sqlCon, "TestTable2DArray") If $DeleteTable = 1 Then MsgBox(48, "Success", "TestTable was dropped") _MSSQL_End($sqlCon) Func MyErrFunc() Local $HexNumber $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1); to check for after this function returns EndFunc ;==>MyErrFunc
-
Hi there, i recently created a new MSSQL.au3, because the only one i found contained only 3 functions. Maybe you can use it. If you need more functions or if you receive an error, contact me and i will try to add or update the UDF ; #CURRENT# ===================================================================================================================== ;~ _MSSQL_Con ;~ _MSSQL_Query ;~ _MSSQL_End ;~ _MSSQL_CreateTable ;~ _MSSQL_CreateColumn ;~ _MSSQL_AddRecord ;~ _MSSQL_GetRecord ;~ _MSSQL_TableExist ;~ _MSSQL_ColumnExist ;~ _MSSQL_ListAllColumns ;~ _MSSQL_ListAllTables ;~ _MSSQL_GetColumninfo ;~ _MSSQL_UpdateRecord ;~ _MSSQL_DeleteRecord ;~ _MSSQL_DropColumn ;~ _MSSQL_DropTable ; =============================================================================================================================== ;=============================================================================== ; ; Function Name....: _MSSQL_CreateTable ; Description......: Creates a New Table ; Syntax...........: _MSSQL_CreateTable($oConnectionObj, $sTable, $identity, $Columnname) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename to create ; $identity = [optional] Should there be a Primarykey (Standard = TRUE) ; $Columnname = [optional] If no Primarykey is created, name of the first Column ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $sTable already exists, @extended ;.........@extended: |1 - $oConnectionObj is not an object ; |2 - $sTable already exists ; |3 - $aResult is not an array ( not happened yet, but maybe possible) ; |4 - Query Error, Query saved to @extended (Check permissions to sys.tables) ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_CreateTable($oConnectionObj, $sTable, $identity = True, $Columnname = "ID") Local $sPrimeKey = "ID", $str, $tableexist If IsObj($oConnectionObj) And Not @error Then $tableexist = _MSSQL_TableExist($oConnectionObj, $sTable) If $tableexist = 1 Then Return SetError(2, @error, 0) If $identity = True Then $str = "CREATE TABLE " & $sTable & " (" & $sPrimeKey & " int IDENTITY (1,1) PRIMARY KEY) ;" Else $str = "CREATE TABLE " & $sTable & " (" & $Columnname & ");" EndIf $oConnectionObj.execute($str) Return 1 ElseIf @error Then Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_CreateTable ;=============================================================================== ; ; Function Name....: _MSSQL_CreateColumn ; Description......: Create one or more new Columns ; Syntax...........: _MSSQL_CreateColumn($oConnectionObj, $sTable, $sColumn, $Null = "NULL", $sDataType = "VARCHAR(45)") ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $sColumn = Columnname and Type ; $Null = [optional] Allow Zero (Standard = True) ; $sDataType = [optional] If $sColumn is an 1-D Array, sets the Columtype for all Columns (Standard = "VARCHAR(45)") ; Requirement......: If $sColumn is an array, it has to be indexed 1, ; - If $sColumn is an 2-D Array, the Columnname has to be in $avArray[$i][0], the datatype has to be in $avArray[0][$i] ; If $sColumn is a String ist, it has to be formated like this: ; - "Name1 varchar(50),Name2 varchar(50),Name3 varchar(50),Name4 varchar(50),NameN Datatype" ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $sColumn has more than 2 dimensions ; |3 - A Columnname from $sColumn already exists in Database ; - The Columnname is saved in @extended ; |4 - A Columnname from $sColumn occurs more than 1 time in the $sColumn ; - The Columnname is saved in @extended ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_CreateColumn($oConnectionObj, $sTable, $sColumn, $Null = True, $sDataType = "VARCHAR(45)") Local $str, $Result, $Columnsplit, $Columnsplit2 If IsObj($oConnectionObj) And Not @error Then If IsArray($sColumn) Then If UBound($sColumn, 2) = 2 Then $str = "ALTER TABLE " & $sTable & " ADD " If $Null = True Then For $i = 1 To UBound($sColumn) - 1 If StringInStr($str, $sColumn[$i][0]) <> 0 Then Return SetError(4, $sColumn[$i][0], 0) $str &= "" & $sColumn[$i][0] & " " & $sColumn[$i][1] & " NULL," Next Else For $i = 1 To UBound($sColumn) - 1 If StringInStr($str, $sColumn[$i][0]) <> 0 Then Return SetError(4, $sColumn[$i][0], 0) $str &= "" & $sColumn[$i][0] & " " & $sColumn[$i][1] & "," Next EndIf For $i = 1 To UBound($sColumn) - 1 $Result = _MSSQL_ColumnExist($oConnectionObj, $sTable, $sColumn[$i][0]) If $Result = 1 Then Return SetError(3, $sColumn[$i][0], 0) Next ElseIf UBound($sColumn, 2) = 0 And @error = 2 Then $str = "ALTER TABLE " & $sTable & " ADD " If $Null = "Null" Then For $i = 1 To UBound($sColumn) - 1 If StringInStr($str, $sColumn[$i]) <> 0 Then Return SetError(4, $sColumn[$i], 0) $str &= "" & $sColumn[$i] & " " & $sDataType & " NULL," Next Else For $i = 1 To UBound($sColumn) - 1 If StringInStr($str, $sColumn[$i]) <> 0 Then Return SetError(4, $sColumn[$i], 0) $str &= "" & $sColumn[$i] & " " & $sDataType & "," Next EndIf For $i = 1 To UBound($sColumn) - 1 $Result = _MSSQL_ColumnExist($oConnectionObj, $sTable, $sColumn[$i]) If $Result = 1 Then Return SetError(3, $sColumn[$i], 0) Next Else Return SetError(2, 0, 0) EndIf $str = StringTrimRight($str, 1) & ";" $oConnectionObj.execute($str) Else $str = "ALTER TABLE " & $sTable & " ADD " & $sColumn & ";" $Columnsplit = StringSplit($sColumn, ",") For $i = 1 To $Columnsplit[0] $Columnsplit2 = StringSplit($Columnsplit[$i], " ") $Result = _MSSQL_ColumnExist($oConnectionObj, $sTable, $Columnsplit2[1]) If $Result = 1 Then Return SetError(3, $Columnsplit2[1], 0) Next $oConnectionObj.execute($str) Return 1 EndIf Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_CreateColumn ;=============================================================================== ; ; Function Name....: _MSSQL_AddRecord ; Description......: Creates a new Row in the database ; Syntax...........: _MSSQL_AddRecord($oConnectionObj, $sTable, $Values, $UNIQUE, $condition) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $Values = Values to be inserted into the table ; $UNIQUE = [optional] Set to True to avoid double data ; $condition = [optional] condition, how to determine double data ; Requirement......: You need to add a Value for each Column in the Table ; If $Values is an Array , it has to be indexed 1, ; If $Values is a String , it has to be formated like this: ; - 'Value1', 'Value2', 'Value3', 'Value4', 'Value5', 'Value n' ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $condition was not set ; |3 - Only returned if $UNIQUE = True ; - All Values already in Database ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_AddRecord($oConnectionObj, $sTable, $Values, $UNIQUE = False, $condition = "") Local $str, $check If IsObj($oConnectionObj) And Not @error Then If IsArray($Values) Then If UBound($Values, 2) = 0 Then $str = "INSERT INTO " & $sTable & " VALUES('" For $grades = 1 To UBound($Values) - 1 If $UNIQUE = False Then $str &= $Values[$grades] & "', '" Else If $condition = "" Then Return SetError(2, 0, 0) $check = _MSSQL_GetRecord($oConnectionObj, $sTable, "*", $condition) If @error = 4 Then $str &= $Values[$grades] & "', '" EndIf EndIf Next $str = StringTrimRight($str, 3) & ");" ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $str = ' & $str & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console If StringRight($str, 7) = "VALUE);" Then Return SetError(3, 0, 0) $oConnectionObj.execute($str) Return 1 Else For $rows = 1 To UBound($Values) - 1 $str = "INSERT INTO " & $sTable & " VALUES('" For $grades = 1 To UBound($Values, 2) - 1 If $UNIQUE = False Then $str &= $Values[$rows][$grades] & "', '" Else If $condition = "" Then Return SetError(2, 0, 0) $check = _MSSQL_GetRecord($oConnectionObj, $sTable, "*", $condition) If @error = 4 Then $str &= $Values[$rows][$grades] & "', '" EndIf EndIf Next $str = StringTrimRight($str, 3) & ");" ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $str = ' & $str & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console If StringRight($str, 7) = "VALUE);" Then Return SetError(3, 0, 0) $oConnectionObj.execute($str) Next Return 1 EndIf Else If $UNIQUE = False Then $str = "INSERT INTO " & $sTable & " VALUES(" & $Values & ");" Else If $condition = "" Then Return SetError(2, 0, 0) $check = _MSSQL_GetRecord($oConnectionObj, $sTable, "*", $condition) If @error = 4 Then $str = "INSERT INTO " & $sTable & " VALUES(" & $Values & ");" Else Return SetError(3, 0, 0) EndIf EndIf $oConnectionObj.execute($str) Return 1 EndIf Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_AddRecord ;=============================================================================== ; ; Function Name....: _MSSQL_GetRecord ; Description......: Get one or more Values from Database ; Syntax...........: _MSSQL_GetRecord($oConnectionObj, $sTable, $Columns = "*", $condition = "", $order = "") ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $sColumn = [optional] Name of one or more Columns in the Table [ Standard = "*" (all Columns)] ; $condition = [optional] A WHERE Case, to look for special Values [Standard = "" (all Values)] ; - The datafields in the WHERE Case have to be like this: 'VALUE' ; $order = [optional] ORDER BY Case, to sort the returned values [Standard = "" (no order)] ; Requirement......: If $sColumn is an Array it has to be indexed 1, ; - $sColumn contains the Columns to read from ; Return Value(s)..: Success - Returns an array ; - If you searched in only one column, $aResult is a 1-D Array, where $aResult[0] is the number of found values ; - If you searched in more then one column, $aResult is multidimensional, where $aResult[0][n] is the number of found values ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $aResult is not an array ( not happened yet, but msaybe possible) ; |3 - $sColumn is not an 1-D array ; |4 - Query Error, Query saved to @extended ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_GetRecord($oConnectionObj, $sTable, $Columns = "*", $condition = "", $order = "") Local $str, $quer, $aResult, $iColumns, $iRows If IsObj($oConnectionObj) And Not @error Then If IsArray($Columns) Then If UBound($Columns, 2) - 1 <> 1 Then Return SetError(3, 0, 0) $str = "SELECT '" For $i = 1 To UBound($Columns) - 1 $str &= $Columns[$i] & "','" Next If $order = "" Then $str = StringTrimRight($str, 2) & "FROM " & $sTable & " " & $condition & ";" Else $str = StringTrimRight($str, 2) & "FROM " & $sTable & " " & $condition & " ORDER BY " & $order & " ;" EndIf $quer = $oConnectionObj.execute($str) With $quer If Not .EOF Then $aResult = .GetRows() If IsArray($aResult) And UBound($aResult, 2) > 1 Then $iColumns = UBound($aResult, 2) $iRows = UBound($aResult) ReDim $aResult[$iRows + 1][$iColumns] For $x = $iRows To 1 Step -1 For $y = 0 To $iColumns - 1 $aResult[$x][$y] = $aResult[$x - 1][$y] Next Next For $i = 0 To $iColumns - 1 $aResult[0][$i] = .Fields($i).Name Next ElseIf IsArray($aResult) And UBound($aResult, 2) = 1 Then $iRows = UBound($aResult) Local $bResult[$iRows + 1] For $x = $iRows To 1 Step -1 $bResult[$x] = $aResult[$x - 1][0] Next $bResult[0] = $iRows Return $bResult Else Return SetError(2, 0, 0) EndIf Else Return SetError(4, $str, 0) EndIf EndWith Return $aResult Else If $order = "" Then If $Columns = "*" Then $quer = $oConnectionObj.execute("SELECT " & $Columns & " FROM " & $sTable & " " & $condition & ";") Else $quer = $oConnectionObj.execute("SELECT '" & $Columns & "' FROM " & $sTable & " " & $condition & ";") EndIf Else If $Columns = "*" Then $quer = $oConnectionObj.execute("SELECT " & $Columns & " FROM " & $sTable & " " & $condition & " ORDER BY " & $order & " ;") Else $quer = $oConnectionObj.execute("SELECT '" & $Columns & "' FROM " & $sTable & " " & $condition & " ORDER BY " & $order & " ;") EndIf EndIf If Not $quer.EOF Then $aResult = $quer.GetRows() If IsArray($aResult) And UBound($aResult, 2) > 1 Then $iColumns = UBound($aResult, 2) $iRows = UBound($aResult) ReDim $aResult[$iRows + 1][$iColumns] For $x = $iRows To 1 Step -1 For $y = 0 To $iColumns - 1 $aResult[$x][$y] = $aResult[$x - 1][$y] Next Next For $i = 0 To $iColumns - 1 $aResult[0][$i] = $quer.Fields($i).Name Next ElseIf IsArray($aResult) And UBound($aResult, 2) = 1 Then $iRows = UBound($aResult) Local $bResult[$iRows + 1] For $x = $iRows To 1 Step -1 $bResult[$x] = $aResult[$x - 1][0] Next $bResult[0] = $iRows Return $bResult Else Return SetError(2, 0, 0) EndIf Else Return SetError(4, $str, 0) EndIf Return $aResult EndIf EndIf Return SetError(1, 0, 0) EndFunc ;==>_MSSQL_GetRecord ;=============================================================================== ; ; Function Name....: _MSSQL_TableExist ; Description......: Checks, if a Table Exists ; Syntax...........: _MSSQL_TableExist($oConnectionObj, $sTable) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - Table not found ; |3 - Query Error, Query saved to @extended (Check Permissions on sys.tables) ; - also Returned when Table does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_TableExist($oConnectionObj, $sTable) Local $quer If IsObj($oConnectionObj) And Not @error Then $quer = $oConnectionObj.execute("SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" & $sTable & "';") If Not $quer.EOF Then Return 1 Else Return SetError(3, "SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" & $sTable & "';", 0) EndIf Return SetError(2, 0, 0) Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_TableExist ;=============================================================================== ; ; Function Name....: _MSSQL_ColumnExist ; Description......: Checks if a Column exists ; Syntax...........: _MSSQL_ColumnExist($oConnectionObj, $sTable, $sColumn) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $sColumn = Columnname ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - Column not found ; |3 - Table not found ; |3 - Query Error, Query saved to @extended (Check Permissions on sys.columns) ; - also Returned when Column does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_ColumnExist($oConnectionObj, $sTable, $sColumn) Local $quer If IsObj($oConnectionObj) And Not @error Then If not _MSSQL_TableExist($oConnectionObj, $sTable) Then Return SetError(3,0,0) $quer = $oConnectionObj.execute("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = '" & $sColumn & "' AND TABLE_NAME = '" & $sTable & "';") If Not $quer.EOF Then Return 1 Else Return SetError(4, "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = '" & $sColumn & "' AND TABLE_NAME = '" & $sTable & "';", 0) EndIf Return SetError(2, 0, 0) Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_ColumnExist ;=============================================================================== ; ; Function Name....: _MSSQL_Con ; Description......: Connect to a Database ; Syntax...........: _MSSQL_Con($scIP, $scUser, $scPass, $scDB) ; Parameter(s).....: $scIP = IP adress ; $scUser = User ; $scPass = Pass ; $scDB = Database ; Return Value(s)..: Success - Returns the Database-"handle" ; ;=============================================================================== Func _MSSQL_Con($scIP, $scUser, $scPass, $scDB) Local $sqlCon $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open("Provider=SQLOLEDB; Data Source=" & $scIP & "; User ID=" & $scUser & "; Password=" & $scPass & "; database=" & $scDB & ";") Return $sqlCon EndFunc ;==>_MSSQL_Con ;=============================================================================== ; ; Function Name....: _MSSQL_Query ; Description......: Send a Query to the Database ; Syntax...........: _MSSQL_Query($iSQLCon, $iQuery) ; Parameter(s).....: $iSQLCon = $oConnectionObj = Object, returned by _MSSQL_Con ; $iQuery = MSSQL Query ; Return Value(s)..: Success - Returns the Response from the server ; ;=============================================================================== Func _MSSQL_Query($iSQLCon, $iQuery) If IsObj($iSQLCon) Then Return $iSQLCon.execute($iQuery) EndIf EndFunc ;==>_MSSQL_Query ;=============================================================================== ; ; Function Name....: _MSSQL_End ; Description......: Close SQL Session ; Syntax...........: _MSSQL_End($sqlCon) ; Parameter(s).....: $sqlCon = $oConnectionObj = Object, returned by _MSSQL_Con ; Return Value(s)..: - ; ;=============================================================================== Func _MSSQL_End($sqlCon) If IsObj($sqlCon) Then $sqlCon.close EndIf EndFunc ;==>_MSSQL_End ;=============================================================================== ; ; Function Name....: _MSSQL_ListAllColumns ; Description......: List all Columns from an existing Table ; Syntax...........: _MSSQL_ListAllColumns($oConnectionObj, $sTable) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; Return Value(s)..: Success - Returns an Array ; - $aResult[0] returns the number of Columns ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $aResult is not an array ( not happened yet, but maybe possible) ; |3 - $sTable does not exist ; |4 - Query Error, Query saved to @extended ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_ListAllColumns($oConnectionObj, $sTable) Local $quer, $aResult, $iRows If IsObj($oConnectionObj) And Not @error Then If not _MSSQL_TableExist($oConnectionObj, $sTable) Then Return SetError(3,0,0) $quer = $oConnectionObj.execute("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" & $sTable & "';") If Not $quer.EOF Then $aResult = $quer.GetRows() If IsArray($aResult) And UBound($aResult, 2) = 1 Then $iRows = UBound($aResult) Local $bResult[$iRows + 1] For $x = $iRows To 1 Step -1 $bResult[$x] = $aResult[$x - 1][0] Next $bResult[0] = $iRows Return $bResult Else Return SetError(2, 0, 0) EndIf Else Return SetError(4, "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" & $sTable & "';", 0) EndIf Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_ListAllColumns ;=============================================================================== ; ; Function Name....: _MSSQL_ListAllTables ; Description......: List all tables from the database ; Syntax...........: _MSSQL_ListAllTables($oConnectionObj) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; Return Value(s)..: Success - Returns an 2-D Array ; - $Return[0][0] = number of tables ; - $Return[$i][n] = Tablename ; - $Return[$i][n] = Table Type ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $aResult is not an array ( not happened yet, but maybe possible) ; |3 - No permissions to INFORMATION_SCHEMA.TABLES ; - also returned, if no Tables exist at all ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_ListAllTables($oConnectionObj) Local $quer, $aResult, $iColumns, $iRows If IsObj($oConnectionObj) And Not @error Then $quer = $oConnectionObj.execute("SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES;") If Not $quer.EOF Then $aResult = $quer.GetRows() If IsArray($aResult) And UBound($aResult, 2) = 2 Then $iColumns = UBound($aResult, 2) $iRows = UBound($aResult) ReDim $aResult[$iRows + 1][$iColumns] For $x = $iRows To 1 Step -1 For $y = 0 To $iColumns - 1 $aResult[$x][$y] = $aResult[$x - 1][$y] Next Next $aResult[0][0] = $iRows $aResult[0][1] = "" Return $aResult Else Return SetError(2, 0, 0) EndIf Else Return SetError(3, 0, 0) EndIf Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_ListAllTables ;=============================================================================== ; ; Function Name....: _MSSQL_GetColumninfo ; Description......: Get Information about a Column ; Syntax...........: _MSSQL_GetColumninfo($oConnectionObj, $sTable, $sColumn = "Allcolumns") ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $sColumn = [optional] Column to get info about (Standard = AllColumns) ; Return Value(s)..: Success - Returns an multidimensional Array ; - $Return[$i][0] = Name of the Column ; - $Return[$i][1] = Allow Zero ; - In $Return[$i][2] = Datatype ; - In $Return[$i][3] = Max Character Lenght ; - In $Return[$i][4] = COLLATION NAME (i.E. latin1) ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $aResult is not an array ( not happened yet, but maybe possible) ; |3 - $sTable or $sColumn does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_GetColumninfo($oConnectionObj, $sTable, $sColumn = "Allcolumns") Local $quer, $aResult, $iColumns, $iRows If IsObj($oConnectionObj) And Not @error Then If $sColumn = "Allcolumns" Then $quer = $oConnectionObj.execute("SELECT COLUMN_NAME, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" & $sTable & "';") Else $quer = $oConnectionObj.execute("SELECT COLUMN_NAME, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" & $sTable & "' AND COLUMN_NAME = '" & $sColumn & "';") EndIf If Not $quer.EOF Then $aResult = $quer.GetRows() If IsArray($aResult) And UBound($aResult, 2) > 1 Then $iColumns = UBound($aResult, 2) $iRows = UBound($aResult) ReDim $aResult[$iRows + 1][$iColumns] For $x = $iRows To 1 Step -1 For $y = 0 To $iColumns - 1 $aResult[$x][$y] = $aResult[$x - 1][$y] Next Next For $i = 0 To $iColumns - 1 $aResult[0][$i] = $quer.Fields($i).Name Next Return $aResult Else Return SetError(2, 0, 0) EndIf Else Return SetError(3, 0, 0) EndIf Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_GetColumninfo ;=============================================================================== ; ; Function Name....: _MSSQL_UpdateRecord ; Description......: Update one or more Values ; Syntax...........: _MSSQL_UpdateRecord($oConnectionObj, $sTable, $sColumn , $sValue, $condition = "") ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $sColumn = Columnname to update Value in ; $sValue = Value to change into ; $condition = [optional] A WHERE Case, to limit the found Values [Standard = "" (all Values in a Column)] ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $sTable does not exist ; |3 - $sColumn does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_UpdateRecord($oConnectionObj, $sTable, $sColumn, $sValue, $condition = "") Local $tableexist, $columnexist, $str, $quer If IsObj($oConnectionObj) And Not @error Then $tableexist = _MSSQL_TableExist($oConnectionObj, $sTable) If $tableexist = 0 Then Return SetError(2, 0, 0) $columnexist = _MSSQL_ColumnExist($oConnectionObj, $sTable, $sColumn) If $columnexist = 0 Then Return SetError(3, 0, 0) If $condition = "" Then $str = "UPDATE " & $sTable & " SET " & $sColumn & " = " & $sValue & ";" $quer = $oConnectionObj.execute($str) Else $str = "UPDATE " & $sTable & " SET " & $sColumn & " = " & $sValue & " " & $condition & ";" $quer = $oConnectionObj.execute($str) EndIf Return 1 Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_UpdateRecord ;=============================================================================== ; ; Function Name....: _MSSQL_DeleteRecord ; Description......: Delete one or more Rows from a Table ; Syntax...........: _MSSQL_DeleteRecord($oConnectionObj, $sTable, $condition = "") ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; $condition = [optional] A WHERE Case, to limit deleted rows [Standard = "" (all rows in table)] ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $sTable does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_DeleteRecord($oConnectionObj, $sTable, $condition = "") Local $tableexist, $columnexist, $str, $quer If IsObj($oConnectionObj) And Not @error Then $tableexist = _MSSQL_TableExist($oConnectionObj, $sTable) If $tableexist = 0 Then Return SetError(2, 0, 0) If $condition = "" Then $str = "DELETE FROM " & $sTable & ";" $quer = $oConnectionObj.execute($str) Else $str = "DELETE FROM " & $sTable & " " & $condition & ";" $quer = $oConnectionObj.execute($str) EndIf Return 1 Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_DeleteRecord ;=============================================================================== ; ; Function Name....: _MSSQL_DropTable ; Description......: Delete a Table from Database ; Syntax...........: _MSSQL_DropTable($oConnectionObj, $sTable) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $sTable does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_DropTable($oConnectionObj, $sTable) If IsObj($oConnectionObj) And Not @error Then If Not _MSSQL_TableExist($oConnectionObj, $sTable) Then Return SetError(2, 0, 0) $str = "DROP TABLE " & $sTable & ";" $quer = $oConnectionObj.execute($str) Return 1 Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_DropTable ;=============================================================================== ; ; Function Name....: _MSSQL_DropColumn ; Description......: Delete a Column from a Table ; Syntax...........: _MSSQL_DropColumn($oConnectionObj, $sTable) ; Parameter(s).....: $oConnectionObj = Object, returned by _MSSQL_Con ; $sTable = Tablename ; Return Value(s)..: Success - 1 ; Failure - 0, sets @error ; |1 - $oConnectionObj is not an object ; |2 - $sTable does not exist ; |3 - $sColumn does not exist ; Author(s)........: TheLuBu <LuBu@veytal.com> ; ;=============================================================================== Func _MSSQL_DropColumn($oConnectionObj, $sTable, $sColumn) If IsObj($oConnectionObj) And Not @error Then If Not _MSSQL_TableExist($oConnectionObj, $sTable) Then Return SetError(2, 0, 0) If Not _MSSQL_ColumnExist($oConnectionObj, $sTable, $sColumn) Then Return SetError(3, 0, 0) $str = "ALTER TABLE " & $sTable & " DROP COLUMN " & $sColumn & ";" $quer = $oConnectionObj.execute($str) Return 1 Else Return SetError(1, 0, 0) EndIf EndFunc ;==>_MSSQL_DropColumn (Sorry for the poor comments, i´m from germany, so my english is not so good ) TheLuBu
-
XProTec.au3 = automated Protect and get *Paid*
TheLuBu replied to Valuater's topic in AutoIt Example Scripts
Hi there, Sorry if my english is not so good, i´m from germany i would like to know if it´s possible to make XProtect work monthly. I´ve got a Script and want to sell it for a monthly fee, but XProtect just works one-time. Thanks for your help TheLuBu