Sign in to follow this  
Followers 0
madmatrix

Problem with SQLite

2 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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  
Followers 0