Need help on Update commandtext

Hi,

I am very new to VB.net Please help!

I am writing a form that is connected to sql database.

I have the add, delete buttons working fine, but not for the edit which updates the record.

here is the code for btnSave which used for both add and edit:

'********

SetButtonsAfterEdit()

lockBoxes()

mbmSupplier.EndCurrentEdit()

daSupplier.Update(DsSupplier1)

DsSupplier1.AcceptChanges()

*********

But when I click save after updating the textboxes, I received an error message saying that the update commandtext is not initialized, so I click on the property window and select the commandtext and use the build query to build the query it says that I have syntax error.

Here is the commandtext. I added the where cause at the end. But it doesn't matter whether it is there or not, it still generates error message. Please help me! I have no clue what is going on.

UPDATE tblSupplier
SET Name = , Address = , Phone = , City = , Prov = , PC = , Country = , Terms =
where supplierid =

(SupplierId is the primary key with identity)

Thanks.

Anita



Answer this question

Need help on Update commandtext

  • Prasant Swain

    You either need to set the UpdateCommand property of the adapter, or use a command builder (e.g. SqlCommandBuilder or OleDbCommandBuilder).

  • Need help on Update commandtext