Jump to content
Sign in to follow this  
joboy2k

SQL help

Recommended Posts

joboy2k

hey guys. iv started to venture in to the sqlite commands and im hitting the same error which is prohibiting me from learning how to use it.

i keep getting this error message

! SQLite.au3 Error

--> Function: _SQLite_Open

--> Error: Library used incorrectly

i then borrowed this code from another help topic to see if it was just me not understanding what im doing but i got the same error message

#include <iNet.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>

$treeviewini = @DesktopCommonDir&"\ini.ini"
iniwrite($treeviewini,1,1,1)
Func _ScanNetwork()

$StartIP =  StringSplit(IniRead( $TreeViewINI, "Configure", "Scan Range Begin","NotFound"),".")
$EndIP =    StringSplit(IniRead( $TreeViewINI, "Configure", "Scan Range End","NotFound"),".")

Dim $aIp1[5]
Dim $Result


SplashTextOn("Network Scan", "Scanning...", 200,200, -1, -1, 20, "")
    for $i =$StartIP[1] to 255
        for $j = $StartIP[2] to 255
            for $k =$StartIP[3] to 255
                for $L = $StartIP[4] to 255

                    $ip = ($aIp1[1] + $i) & "." & ($aIp1[2] + $j) & "." & ($aIp1[3] + $k) & "." & ( $aIp1[4] + $l )
                    $ping = Ping($ip,1)

                    if $ping then
                        $Result = $ip & " is on"

                        TCPStartup()
                        $Hostname = _TCPIpToName ($ip)
                        TCPShutdown ()

                            If @error Then
                                MsgBox(0, "_TCPIpToName()", "@error = " & @error & @LF & "@extended = " & @extended)
                            Else
                                _SQLite_Startup ()
                                _SQLite_Open (@Scriptdir & "\database\test.db")
                                $qq = _SQLite_Exec (-1, "INSERT INTO PCInfo(Name, IP) VALUES ('" & $Hostname & "', '" & $ip & "');")
                                ;msgbox(0,$SQLITE_OK,@error)

                                _SQLite_Close()
                                _SQLite_Shutdown()

                            EndIf
                        Else
                        $Result = $ip & " is off"
                    endif
                    ControlSetText("Network Scan", "", "Static1", $Result)

                    ;Test to see if we are at the last IP.  If so, break the loop
                    If $i & $j & $k & $L= $EndIP[1] & $EndIP[2] & $EndIP[3] & $EndIP[4] Then
                        $AtEndofIPRange = 1
                        ExitLoop
                    EndIf
                Next
                If $AtEndofIPRange = 1 then ExitLoop
            Next
            If $AtEndofIPRange = 1 then ExitLoop
        Next
        If $AtEndofIPRange = 1 then ExitLoop
    next
    ;Sleep(1000)
    SplashOff()
EndFunc
_scannetwork()

obviously i know the problem is in this section and i think its go to do with the _SQLite_open command but i dont understand whats wrong

_SQLite_Startup ()
       _SQLite_Open (@Scriptdir & "\database\test.db")
         $qq = _SQLite_Exec (-1, "INSERT INTO PCInfo(Name, IP) VALUES ('" & $Hostname & "', '" & $ip & "');")
            ;msgbox(0,$SQLITE_OK,@error)

            _SQLite_Close()
       _SQLite_Shutdown()

please help because its gone over my head why i cant figure it out. thank you

Share this post


Link to post
Share on other sites
joboy2k

im sorry i found the reason. i didnt realice that the SQLite open command didnt create the directory also. i just tried it and it works im sorry for the waste of your time reading this. thanks anyway

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.