Jump to content
Sign in to follow this  
jazzyjeff

_SQLite_GetTable2d no passing array

Recommended Posts

jazzyjeff

Hello,

I have a SQL Lite database that has just over 800 records right now, though this is going to increase rapidly when school starts next week.

The idea of this script is that when a user logs into their machine the user and computer information is logged into the database. Adding the information to the database is working great. 

I am trying to create a tool to view this information. 

I have been trying to get the _SQLite_GetTable2d function to pass out the database records into an array. If I am understanding the function correctly, this is what it should do.
The problem is I cannot get the function to pass out an array. Can someone please look at my script and tell me what I have wrong or what I am missing please?

Thanks.

#include <SQLite.au3>
#include <SQLite.DLL.au3>
#include <Array.au3>

Local $hQuery
Local $aResult, $iRows, $iColumns

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
$sql = _SQLite_Open("\\server\share$\Login logs.db")
$iRVal = _SQLite_GetTable2d($sql, 'SELECT * FROM LoginLogs;', $aResult, $iRows, $iColumns)
If @error Then
    MsgBox(0,"",@error)
Else
    $aResult = (($iRows) + 1) * ($iColumns)
    MsgBox(0,"","No error" & @CR & "Result: " & $aResult & @CR & "Rows: " & $iRows & @CR & "Columns: " & $iColumns & @CR & "Error code: " & _SQLite_ErrCode($sql) & @CR & "Error msg: " & _SQLite_ErrMsg($sql))
EndIf
_SQLite_Display2DResult($aResult)
_ArrayDisplay($aResult)

Share this post


Link to post
Share on other sites
jazzyjeff

Sorry everyone, false alarm. I have been banging my head against a wall for an hour on this, but I now I see it staring me in the face as to what was causing the issue.

I created this IF statement after running the function because i thought it would HELP me if there were problems. :-)

The if statement was in fact changing the array variable so it wasn't an array anymore. Such an idiot! sorry, and thanks.

If @error Then
    MsgBox(0,"",@error)
Else
    $aResult = (($iRows) + 1) * ($iColumns)
    MsgBox(0,"","No error" & @CR & "Result: " & $aResult & @CR & "Rows: " & $iRows & @CR & "Columns: " & $iColumns & @CR & "Error code: " & _SQLite_ErrCode($sql) & @CR & "Error msg: " & _SQLite_ErrMsg($sql))
EndIf

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
Sign in to follow this  

×