Jump to content

Problem with SQLite


Recommended Posts

Hi all,

I just started learning Autoit and want to insert some values into my current SQLite table. Here is my SQLite command:

_SQLite_Exec(-1, "INSERT INTO Inventory(ItemNum,InventoryNum,OrderNum,SKU,Product,OrderDate,Quant,Price,ShippingCost,Tax,Discount) VALUES ($sItemNum,$sInventoryNum,$sOrderNum,$aSKU[$j],$aProduct[$j],$sOrderDate,$aQuant[$j],$aPrice[$j],$dShippingCost/(UBound($sResults)-1),$dTax/(UBound($sResults)-1),$dDiscount);")

Autoit says error reading [j] that I uses as index in the loop. Don't know why this variable can't be evaluated in SQLite command.

Any Idea?

Thanks.

Lou

Link to comment
Share on other sites

Hi all,

I just started learning Autoit and want to insert some values into my current SQLite table. Here is my SQLite command:

_SQLite_Exec(-1, "INSERT INTO Inventory(ItemNum,InventoryNum,OrderNum,SKU,Product,OrderDate,Quant,Price,ShippingCost,Tax,Discount) VALUES ($sItemNum,$sInventoryNum,$sOrderNum,$aSKU[$j],$aProduct[$j],$sOrderDate,$aQuant[$j],$aPrice[$j],$dShippingCost/(UBound($sResults)-1),$dTax/(UBound($sResults)-1),$dDiscount);")

Autoit says error reading [j] that I uses as index in the loop. Don't know why this variable can't be evaluated in SQLite command.

Any Idea?

Thanks.

Lou

You have the variable references inside the quotes, making them plain strings. It should be more like this:
$sQuery = "INSERT INTO Inventory(" & _
                "ItemNum,InventoryNum,OrderNum,SKU,Product,OrderDate,Quant,Price,ShippingCost,Tax,Discount) " & _
                "VALUES (" & $sItemNum & "," & $sInventoryNum & "," & $sOrderNum & "," & $aSKU[$j] & "," & _
                $aProduct[$j] & "," & $sOrderDate & "," & $aQuant[$j] & "," & $aPrice[$j] & "," & _
                $dShippingCost/(UBound($sResults)-1) & "," & $dTax/(UBound($sResults)-1),$dDiscount) & ";"
        _SQLite_Exec(-1, $sQuery)

:P

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...