From: Jay on
In sql server I can run the following query command to update QtyOnPO field.

UPDATE ItemsDetails
SET QtyOnPO = QtyOnPO + 1
WHERE (ItemDetailID = 1)

This will add 1 to QtyOnPO field.

In VB.NET how can I use this?

The following is my code but it gives an error "Name 'QtyOnPO' is not
declared".

ExecNonQuery("UPDATE Pricing SET QtyOnPO = " & QtyOnPO +
row.Cells(Me.Qty.Index).Value & " WHERE ItemDetailID = " & intItemDetailID)

Please help

From: Jason Keats on
Jay wrote:
> In sql server I can run the following query command to update QtyOnPO
> field.
>
> UPDATE ItemsDetails
> SET QtyOnPO = QtyOnPO + 1
> WHERE (ItemDetailID = 1)
>
> This will add 1 to QtyOnPO field.
>
> In VB.NET how can I use this?
>
> The following is my code but it gives an error "Name 'QtyOnPO' is not
> declared".
>
> ExecNonQuery("UPDATE Pricing SET QtyOnPO = " & QtyOnPO +
> row.Cells(Me.Qty.Index).Value & " WHERE ItemDetailID = " & intItemDetailID)
>
> Please help

Dim sql As String

sql = "UPDATE Pricing SET"
sql &= " QtyOnPO = QtyOnPO + " & row.Cells(Me.Qty.Index).Value
sql &= " WHERE ItemDetailID = " & intItemDetailID

Debug.WriteLine(sql) 'check what you're going to execute

Etc.

From: Jay on
Thank you

"Jason Keats" <jkeats(a)melbpcDeleteThis.org.au> wrote in message
news:#DNTJi24KHA.420(a)TK2MSFTNGP02.phx.gbl...
> Jay wrote:
>> In sql server I can run the following query command to update QtyOnPO
>> field.
>>
>> UPDATE ItemsDetails
>> SET QtyOnPO = QtyOnPO + 1
>> WHERE (ItemDetailID = 1)
>>
>> This will add 1 to QtyOnPO field.
>>
>> In VB.NET how can I use this?
>>
>> The following is my code but it gives an error "Name 'QtyOnPO' is not
>> declared".
>>
>> ExecNonQuery("UPDATE Pricing SET QtyOnPO = " & QtyOnPO +
>> row.Cells(Me.Qty.Index).Value & " WHERE ItemDetailID = " &
>> intItemDetailID)
>>
>> Please help
>
> Dim sql As String
>
> sql = "UPDATE Pricing SET"
> sql &= " QtyOnPO = QtyOnPO + " & row.Cells(Me.Qty.Index).Value
> sql &= " WHERE ItemDetailID = " & intItemDetailID
>
> Debug.WriteLine(sql) 'check what you're going to execute
>
> Etc.
>
>
From: Cor Ligthert[MVP] on
So QtyOnPo which has to be a (numeric) field, property or method(returning a
number), is not declared (available) in the method where you use it.

(Most probably it is a not created global field, while you had the intention
to do that)

"Jay" <jpabs78(a)gmail.com> wrote in message
news:epTXzW14KHA.3824(a)TK2MSFTNGP04.phx.gbl...
> In sql server I can run the following query command to update QtyOnPO
> field.
>
> UPDATE ItemsDetails
> SET QtyOnPO = QtyOnPO + 1
> WHERE (ItemDetailID = 1)
>
> This will add 1 to QtyOnPO field.
>
> In VB.NET how can I use this?
>
> The following is my code but it gives an error "Name 'QtyOnPO' is not
> declared".
>
> ExecNonQuery("UPDATE Pricing SET QtyOnPO = " & QtyOnPO +
> row.Cells(Me.Qty.Index).Value & " WHERE ItemDetailID = " &
> intItemDetailID)
>
> Please help
>