DataSet Update Problem

mmb

Active member
Joined
Aug 1, 2004
Messages
42
Programming Experience
1-3
Hi
I made a FORM by Simply Binding and Complex binding the Controls.

I have buttons on the FORM ADD,DELETE And CANCEL which directly affects the DATASET.

On save button I have used the dataset method UPDATE that is


DataAdapter.update(dataset,"TableName")

But I get exception that Proper Query Required.

Pls help me out.
 
Have you tried using the dataform wizard to generate the Update code. You could start a new form and copy the code or just use the dataform and update it. The wizard also handles add, delete, and cancel code. You should be able to easily replicate your form and have the code written for you.
 
I want to do it through CODE

Thanks for the Help buddy.

I know that dataform wizard can generate me a form that I want. But I want to do it through code. If any can help me throught code I'll really be thankful.

Regards.
 
mmb said:
Hi
I made a FORM by Simply Binding and Complex binding the Controls.

I have buttons on the FORM ADD,DELETE And CANCEL which directly affects the DATASET.

On save button I have used the dataset method UPDATE that is


DataAdapter.update(dataset,"TableName")

But I get exception that Proper Query Required.

Pls help me out.
what do ya mean by proper query required?
 
can you provide code?

What does your update command look like, can you provide code?

SqlUpdateCommand1.CommandText = "UPDATE [Table Name] SET Variable1 = @Param1, Variable2 = @Param2, Variable3 = @Param3
WHERE (Variable1 = @Original_Variable1) AND (Variable2 = @Original_Variable2) AND (Variable3 = @Original_Variable3 OR @Original_Variable3 IS NULL AND Variable3 IS NULL)
; SELECT Variable1, Variable2, Variable3 WHERE (Variable1 = @Param1) AND (Variable2 = @Param2)"

This is the wizard generated update command, variables 1 and 2 are key fields and variable3 allows nulls. Does this help?
sounds like you have a problem with this command but the help guys here would need to see it to be sure.
 
The DataForm Wizard can help you 'through code'.

The Wizard will ask you a set of questions and when you press finish, it will generate the Form and DataSet Schema with all the code needed to operate the form based on your answers. Then you can have a look at the code and see how it's done and even modify it to suit you needs.
 
Back
Top