AutoIT Script Tutorial | Connecting SQLite Database with AutoIt Script Tutorial Part #1

Опубликовано: 13 Октябрь 2022
на канале: Cool IT Help
1,686
13

In this tutorial session we will interact with sqlite database with autoit script. We are going to do following action items in this tutorial. Let's do it together-
Note: we can create 3 types of sqlite database as per our requirement.
1) Creating a :memory: database
2) Creating a temporary disk database
3) Creating a permanent disk database

Note - To avoid "sqlite3.dll "SQLite3.dll Can't be Loaded!" Error -

Prerequisites : we need to download latest 'SQLite.dll.au3' and replace the old one. Please follow my instructions...
Step 1: Run "AutoSQLiteUpdateIt.au3" script from below path:
C:\Program Files (x86)\AutoIt3\Extras\AutoUpdateIt

now go to this location and copy "SQLite.dll.au3":
C:\Users\MacWin\AppData\Local\AutoIt v3\SQLite

Step 2: now we replace old 'SQLite.dll.au3' file with newly downloaded file.
here is the path : C:\Program Files (x86)\AutoIt3\Include

Step 3: Verify -- open autoit Script editor and run following lines of code.

Action Item 1 - Now we Create a memory database:
==========================================
_SQLite_Startup()

If @error Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!")
Exit -1
EndIf

ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)

_SQLite_Open() ; Creates a :memory: database and don't use its handle to refer to it
If @error Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't create a memory Database!")
Exit -1
EndIf

_SQLite_Close()

----------------------------------------------------------------------------------------------------------------
Action Item 2 - Now we Create a temporary disk database:
========================================================

Local $hTmpDb = _SQLite_Open('') ; Creates a temporary disk database
If @error Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't create a temporary Database!")
Exit -1
EndIf

----------------------------------------------------------------------------------------------------------------
Action Item 3 - Now we Create a Permanent disk database:
========================================================
Local $sDbName = _TempFile()
Local $hDskDb = _SQLite_Open($sDbName) ; Open a permanent disk database
If @error Then
MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't open or create a permanent Database!")
Exit -1
EndIf
----------------------------------------------------------------------------------------------------------------
; we can use the 3 database as needed by refering to their handle

; close the Dbs we created, in any order
_SQLite_Close($hTmpDb) ; temporary database are deleted automatically at Close
_SQLite_Close($hDskDb) ; DB is a regular file that could be reopened later
_SQLite_Close($hMemDb)

; we don't really need that DB
FileDelete($sDbName)

_SQLite_Shutdown()

If _SQLite_Startup() failed or was not executed, an AutoIt runtime error will be thrown, and the script will terminate!
AutoIt automatically closes any dlls it opened, but calling _SQLite_Shutdown() is still a good idea.

#AutoItConnectSQliteDatabase #coolithelp


На этой странице сайта вы можете посмотреть видео онлайн AutoIT Script Tutorial | Connecting SQLite Database with AutoIt Script Tutorial Part #1 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Cool IT Help 13 Октябрь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,686 раз и оно понравилось 13 зрителям. Приятного просмотра!