Jump to content

Recommended Posts

PhoenixXL

Hey Every 1 :bye:

When I was a Beginner I always had a Hard Time to Understand the SQLite

I have made a UDF for SQLite so that Beginners Would Also Be Able to Do the Stuff .

Much Of Description is Given in the UDF.

To Understand Read It.

For Advanced Users it may not be sooo goood But Then Also Have a Look .

Thumbs Up if it Helped.. :)

The UDF is Attached for Download..

N herez the Index

#region    -Functions For User-
;_Insert
;_Update
;_Delete
;_FetchData
;_LoadDatabase
;_UnLoadDatabase
;_Cryptor
#endregion    -Functions For User-

#region  -Internal Functions-
;_DefaultAnalyser()
#endregion  -Internal Functions-

1 more Request

If You Use the Script Please Reply me of any Bugs or any Further Modifications for Betterment... :)

The UDF

v0.3 Database.7z

[Previous Downloads : 388]

Regards

Phoenix XL

Edited by PhoenixXL
  • Like 2

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
PhoenixXL

60 Downloads Yet no Reply

Please give Feedback


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
TheSaint

Thanks for sharing!


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
DJKMan

Nice script! Might I suggest using Tidy to make your code easier to read? Press CTRL+T. in scite. :)

One thing I've always pondered on is how to prevent SQL injection. Any suggestions? Stripping is generally the most common technique, although it is generally frowned upon if you rely on this.


My work in AutoIt (Not many yet):

Parse Large Text Files To 2D Array Quickly [With Chunk Size]

 

My artificial intelligence project coded entirely in AutoIt. Meet Alice Assistant: http://facebook.com/ProjectAliceAI

 

Share this post


Link to post
Share on other sites
PhoenixXL

Encrypting the data before storing would be a good idea


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
twitchyliquid64

djkman,

that's a dozy. the main thing is to have a function that separates an SQL statement and data into separate parameters.

then encode the data before inserting it into your sql statement to be executed.

PROBLEM SOLVED. i believe python does this as well.


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites
PhoenixXL

Added : The support for finding the number of rows and cells in v0.2

Check the v0.2 in the First post

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
SmOke_N

Added : The support for finding the number of rows and cells in v0.2

Check the v0.2 in the First post

There are easier ways to get the row and column counts than dragging the entire database into memory.

Keep in mind, some databases could be really large.

Row Count #1

;; Warning, see: http://www.sqlite.org/autoinc.html

Func _Fetch_MaxRowID($h_db, $s_table, $s_condition = "")

    Local $f_dbopened = False
    If $h_db <> -1 And $h_db < 1 Then
        $h_db = _SQLite_Open($h_db, $SQLITE_READONLY)
        If $h_db < 1 Then Return SetError(1, 0, 0)
        $f_dbopened = True
    EndIf

    If $s_condition Then $s_condition = " " & $s_condition
    Local $n_retval, $h_query
    $n_retval = _SQLite_Query($h_db, "SELECT MAX(RowID) FROM " & $s_table & $s_condition & ";", $h_query)
    If $n_retval <> $SQLITE_OK Then
        If $f_dbopened Then _SQLite_Close($h_db)
        Return SetError(2, 0, 0)
    EndIf

    Local $a_r
    _SQLite_FetchData($h_query, $a_r)
    _SQLite_QueryFinalize($h_query)

    If $f_dbopened Then _SQLite_Close($h_db)

    If Not IsArray($a_r) Then Return 0

    Return Int($a_r[0])
EndFunc

Row Count #2 ; a bit slower than the previous but safer

Func _Fetch_RowIDCount($h_db, $s_table, $s_condition = "")

    Local $f_dbopened = False
    If $h_db <> -1 And $h_db < 1 Then
        $h_db = _SQLite_Open($h_db, $SQLITE_READONLY)
        If $h_db < 1 Then Return SetError(1, 0, 0)
        $f_dbopened = True
    EndIf

    If $s_condition Then $s_condition = " " & $s_condition
    Local $n_retval, $h_query
    $n_retval = _SQLite_Query($h_db, "SELECT COUNT(RowID) FROM " & $s_table & $s_condition & ";", $h_query)
    If $n_retval <> $SQLITE_OK Then
        If $f_dbopened Then _SQLite_Close($h_db)
        Return SetError(2, 0, 0)
    EndIf

    Local $a_r
    _SQLite_FetchData($h_query, $a_r)
    _SQLite_QueryFinalize($h_query)

    If $f_dbopened Then _SQLite_Close($h_db)

    If Not IsArray($a_r) Then Return 0

    Return Int($a_r[0])
EndFunc

Column count and column name fetch

Func _Fetch_ColumnCount($h_db, $s_table)

    Local $a_names = _Fetch_ColumnNames($h_db, $s_table)
    If @error Then Return SetError(@error, 0, 0)

    Return UBound($a_names)
EndFunc

Func _Fetch_ColumnNames($h_db, $s_table)

    Local $f_dbopened = False
    If $h_db <> -1 And $h_db < 1 Then
        $h_db = _SQLite_Open($h_db, $SQLITE_READONLY)
        If $h_db < 1 Then Return SetError(1, 0, 0)
        $f_dbopened = True
    EndIf

    Local $n_retval, $h_query
    Local $s_query = "PRAGMA table_info(" & $s_table & ");"
    $n_retval = _SQLite_Query($h_db, $s_query, $h_query)
    If $n_retval <> $SQLITE_OK Then
        If $f_dbopened Then _SQLite_Close($h_db)
        Return SetError(2, 0, 0)
    EndIf

    Local $a_r, $s_names
    While _SQLite_FetchData($h_query, $a_r) = $SQLITE_OK
        $s_names &= $a_r[1] & @CR
    WEnd

    _SQLite_QueryFinalize($h_query)

    If $f_dbopened Then _SQLite_Close($h_db)

    $s_names = StringTrimRight($s_names, 1)
    If Not $s_names Then Return SetError(3, 0, 0)

    Return StringSplit($s_names, @CR, 2)
EndFunc

I did not test them extensively, but they are versions of some things I use.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
PhoenixXL

Thnks I will add them to the UDF


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
SmOke_N

Thnks I will add them to the UDF

I was hoping to enlighten more than have it added.

Good luck.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Zoldex

Hi! Thanks for what seems to be a really useful UDF.

I'm newbie and I'm trying to learn SQLite.

Anyways this is what I get when trying your UDF:

>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Sergio\Downloads\Database v0.2.au3"
->id:1 data: parameters:Hello No. of Cells: 3 No of Rows: 1
->id:1 data:0x2095F423F0E80A284B61C7D890E5E951 parameters:Nothing No. of Cells: 3 No of Rows: 1
-> data:Heya

!> Return Value From _FetchData: -1 Error Code:1

+>16:29:34 AutoIT3.exe ended.rc:0
>Exit code: 0 Time: 1.796

What am I missing?

Edited by Zoldex

Share this post


Link to post
Share on other sites
PhoenixXL

Its just Perfect

Looks as if u didnt read the comments in the examples section


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
Zoldex

Yes! You're right.

The truth is this is my first attempt with sqlite and must finish a project within two months and I was so scared about how difficult it could be that I didn't look enough through your script.

Now, after reading your script, at least I learned hot to properly use the syntax of the sqlite command "insert" and i'm a little less scared now...

Before I was using

_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ($variable,'1','Hello');")

Now I understand I must use

_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES (" & $variable & ",'1','Hello');")

Share this post


Link to post
Share on other sites
PhoenixXL

yep

right

hope so you understand the Example :)


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
Zoldex

Yeah I'm slowly understanding the mechanics...

anyways, I got fooled from the parameter definition you gave:

Syntax: _Insert_Update_Delete($sAction,$sData,$sWhere,$Table_Name='Database')

Parameters:
$sAction :1=Insert , 2=Update , 3=Delete

I guessed (after an hour) that should be

Parameters:

$sAction :0=Insert , 1=Update , 2=Delete

Isn't it?

Share this post


Link to post
Share on other sites
PhoenixXL

oops, my mistake :>

thats right

Parameters:

$sAction :0=Insert , 1=Update , 2=Delete

will change them

Thnx for the clarification


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
Zoldex

Another thing, but it could be my mistake, should be the syntax:

Syntax: _Insert_Update_Delete($sAction,$sData,$sWhere,$Table_Name='Database')

...but in the example you've written

; Inserting into column id,parameters the value 1 and Hello
If $_Just_Created Then _Insert_Update_Delete(0, 'id,parameters', "'1','Hello'")

id,parameters looks like a $sWhere and 1,Hello looks as $sData

I'm a bit confused about that

Edited by Zoldex

Share this post


Link to post
Share on other sites
PhoenixXL

Well dont get to the name of the variables its just the Syntax Sequence with respect to the syntax sequence of the _SQ_LITE commands

That is since Values are after the Column name therefore $sWhere and $sData correspond to them respectively

Hope it helps

I will Update the UDF to make things little bit less confusing :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
PhoenixXL

Hi, Can anyone create a UDF for the FireBird?

you should make a new topic regarding your help requests :)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • ScriptJunky
      By ScriptJunky
      I noticed a lack of a constants file for _WinAPI_GetSystemMetrics() so I made this for anyone who wants to add it to their library. Enjoy!  (file attached below)
      #include-once ; #INDEX# ======================================================================================================================= ; Title .........: WinAPI GetSystemMetrics Constants ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Description ...: Constants for _WinAPI_GetSystemMetrics(). ; Author(s) .....: ScriptJunky ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== ; _WinAPI_GetSystemMetrics() Global Const $ARRANGE = 56 Global Const $CLEANBOOT = 67 Global Const $CMONITORS = 80 Global Const $CMOUSEBUTTONS = 43 Global Const $CONVERTIBLESLATEMODE = 0x2003 Global Const $CXBORDER = 5 Global Const $CXCURSOR = 13 Global Const $CXDLGFRAME = 7 Global Const $CXDOUBLECLK = 36 Global Const $CXDRAG = 68 Global Const $CXEDGE = 45 Global Const $CXFIXEDFRAME = 7 Global Const $CXFOCUSBORDER = 83 Global Const $CXFRAME = 32 Global Const $CXFULLSCREEN = 16 Global Const $CXHSCROLL = 21 Global Const $CXHTHUMB = 10 Global Const $CXICON = 11 Global Const $CXICONSPACING = 38 Global Const $CXMAXIMIZED = 61 Global Const $CXMAXTRACK = 59 Global Const $CXMENUCHECK = 71 Global Const $CXMENUSIZE = 54 Global Const $CXMIN = 28 Global Const $CXMINIMIZED = 57 Global Const $CXMINSPACING = 47 Global Const $CXMINTRACK = 34 Global Const $CXPADDEDBORDER = 92 Global Const $CXSCREEN = 0 Global Const $CXSIZE = 30 Global Const $CXSIZEFRAME = 32 Global Const $CXSMICON = 49 Global Const $CXSMSIZE = 52 Global Const $CXVIRTUALSCREEN = 78 Global Const $CXVSCROLL = 2 Global Const $CYBORDER = 6 Global Const $CYCAPTION = 4 Global Const $CYCURSOR = 14 Global Const $CYDLGFRAME = 8 Global Const $CYDOUBLECLK = 37 Global Const $CYDRAG = 69 Global Const $CYEDGE = 46 Global Const $CYFIXEDFRAME = 8 Global Const $CYFOCUSBORDER = 84 Global Const $CYFRAME = 33 Global Const $CYFULLSCREEN = 17 Global Const $CYHSCROLL = 3 Global Const $CYICON = 12 Global Const $CYICONSPACING = 39 Global Const $CYKANJIWINDOW = 18 Global Const $CYMAXIMIZED = 62 Global Const $CYMAXTRACK = 60 Global Const $CYMENU = 15 Global Const $CYMENUCHECK = 72 Global Const $CYMENUSIZE = 55 Global Const $CYMIN = 29 Global Const $CYMINIMIZED = 58 Global Const $CYMINSPACING = 48 Global Const $CYMINTRACK = 35 Global Const $CYSCREEN = 1 Global Const $CYSIZE = 31 Global Const $CYSIZEFRAME = 33 Global Const $CYSMCAPTION = 51 Global Const $CYSMICON = 50 Global Const $CYSMSIZE = 53 Global Const $CYVIRTUALSCREEN = 79 Global Const $CYVSCROLL = 20 Global Const $CYVTHUMB = 9 Global Const $DBCSENABLED = 42 Global Const $DEBUG = 22 Global Const $DIGITIZER = 94 Global Const $IMMENABLED = 82 Global Const $MAXIMUMTOUCHES = 95 Global Const $MEDIACENTER = 87 Global Const $MENUDROPALIGNMENT = 40 Global Const $MIDEASTENABLED = 74 Global Const $MOUSEPRESENT = 19 Global Const $MOUSEHORIZONTALWHEELPRESENT = 91 Global Const $MOUSEWHEELPRESENT = 75 Global Const $NETWORK = 63 Global Const $PENWINDOWS = 41 Global Const $REMOTECONTROL = 0x2001 Global Const $REMOTESESSION = 0x1000 Global Const $SAMEDISPLAYFORMAT = 81 Global Const $SECURE = 44 Global Const $SERVERR = 289 Global Const $SHOWSOUNDS = 70 Global Const $SHUTTINGDOWN = 0x2000 Global Const $SLOWMACHINE = 73 Global Const $STARTER = 88 Global Const $SWAPBUTTON = 23 Global Const $TABLETPC = 86 Global Const $XVIRTUALSCREEN = 76 Global Const $YVIRTUALSCREEN = 77  
      WinAPISystemMetricsConstants.au3
    • rcmaehl
      By rcmaehl
      A UDF with Extended Functions for Window Management
       
      Notes:
      Fixes WinGetClassList's barbaric returning of a @LF separated string instead of an array.
       
      Potential Uses:
      Automating applications that change their controls' handles/classes on each launch (e.g. half of Cisco's programs)
       
      Functions:
      _WinGetClassList
      _WinGetClassNNList
      _WindowGetHandleList
      _WindowGetHandleListFromPos
       
      Download: 
      WindowEx.zip  (v0.4)
       
      Changelog:
      10/04/2016 (v0.4): _WinGetClassNNList Fixed : Not Returning an Index when using $2D_ARRAY _WinGetClassNNList Fixed : Not Properly returning $aArray[x][1] on Classes with instances > 9 when using $2D_ARRAY 10/03/2016 (v0.3): _WinGetClassList Added : Exactly the same as WinGetClassList but returns a more civilized Array _WinGetClassNNList Added : Returns Classes and their instances in either a 1D or 2D array depending on Flags _WindowGetHandleList Renamed: _WinGetHandleList SCRIPT BREAKING! _WindowGetHandleListFromPos Renamed: _WinGetHandleListFromPos SCRIPT BREAKING! 10/01/2016 (v0.2): WindowsExConstants.au3 Added : Flags in _WindowGetHandleListFromPos _WindowGetHandleListFromPos Removed: ConsoleWrite left in during debug _WindowGetHandleListFromPos Added : Flag for if part of a Control is at $X, $Y return it as well. 10/01/2016 (v0.1): _WindowGetHandleList Added : Retrieves the handles of classes from a window. _WindowGetHandleListFromPos Added : Retrieves the handles of classes at a specific position from a window. Known and Reported Bugs:
      None reported To Do:
      To Be Decided. Opinions welcome! Upcoming Changes:
      To Be Decided.
    • dangr82
      By dangr82
       
      I have created this function for a database, but I can not make it work. I always have two error messages: "not an error" ... and the file created, in the script directory, does not contain anything.
      Global $sDBName = "Hen.db" Func DatabaseTable() Local $sConnDB _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $sConnDB = _SQLite_Open($sDBName) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf If Not _SQLite_Exec($sDBName, 'CREATE TABLE Animal ("Name", "Age");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) If Not _SQLite_Exec($sDBName, 'INSERT INTO Animale VALUES ("Charlie","5");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) _SQLite_Close($sConnDB) _SQLite_Shutdown() EndFunc  
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone

      I was playing a little bit with "Screen Capture" UDF, and I was trying to make a "Window" capture, but, since I made a GUI which through I fire the event "Capture", my GUI is captured as well, and I don't want to
      This is the line of code that makes the capture:
       
      _ScreenCapture_CaptureWnd($strScreenCaptureFileName, $objActiveWindow, 0, 0, -1, -1, False) And these are the lines of code which select the "active" window:
       
      Local $objCurrentWindow = 9999 If _IsPressed("01") Then $objCurrentWindow = WinGetHandle("[ACTIVE]") If $objCurrentWindow <> $objMyGUI Then $objActiveWindow = $objCurrentWindow EndIf EndIf Sorry If I made stupid mistakes
      Thanks in advance.

      Francesco
    • Eminence
      By Eminence
      Hello,
      I've been searching on how to select the first row in my database which includes a time column based on the latest start_time date for today's date.
      This is my current code:
      Local $iCurrentDate = _Now() Local $sqlHandle = _dbOpen($sDbPath) Local $aResult, $iRows, $iCols _SQLite_GetTable2d($sqlHandle, "SELECT start_time FROM " & $srawDb & " ORDER BY datetime(start_time) DESC LIMIT 1", $aResult, $iRows, $iCols) _ArrayDisplay($aResult) _dbClose($sDbpath) What it does is it gets the first row entry in the database however it does not select the latest start_time entry in the database, it always select the first row. I've tried changing DESC to ASC to see if that will do it but the issue still remains. Any thoughts on this? Thanks in advance.
       
      *EDIT
      The date format in the database is by MM/DD/YYYY HH:MM:SS.
×