Update requires a valid UpdateCommand

carlp22

Active member
Joined
Oct 3, 2006
Messages
31
Programming Experience
5-10
Hello,

I have a problem I can't get past. I'm getting the error "Update requires a valid UpdateCommand when passed DataRow collection with modified rows." when trying to update a dataset.

The details:
Using Visual Studio 2005 (VB 2005);
I used the dataset designer to configure the dataset;
I'm using Oracle, with Microsoft's Oracle data provider;
I drug the data set, from the Data Sources tab in VS, to a windows form using the datadridview option;

After changing row data, I click a "Save" button that runs this code -

Me.Validate()
Me.TblUserBindingSource.EndEdit()
Me.TblUserTableAdapter.Update(Me.DataSet_User.tblUser)

I have verified that:
there is a Primary Key on this table;
the Generate Update, Insert, and Delete statements checkbox is checked in the dataset designer.

Does Oracle generate these statements?

PLEASE - any suggestion are greatly needed.

Thanks,
Carl
 
Yes, that's the setup I have. I dont use the Oracle 9i client any more - I use the 10g CLient to access our 9i database
 
Now what?

I installed Oracle Developer Tools for Visual Studio .NET with ODAC 10.2.0.2.21.

Now I can't connect to the Oracle DB at all! ORA-12154: TNS Could not resolve the connect Identifier specified.

Help,
Carl
 
Back up...

Finally, back up. If you could point me to the right area to manage the Primary Key, I would appreciate it.

Thanks,
Carl
 
Found that too - and GOOD NEWS!

I now have:

VB.NET:
  CREATE TABLE "RTRACK_DATA"."TBLUSER" 
   (	"LOGINNAME" VARCHAR2(20) NOT NULL ENABLE, 
	"INITIALS" VARCHAR2(4), 
	"STATUS" VARCHAR2(1) DEFAULT 'A' NOT NULL ENABLE, 
	"FULLNAME" VARCHAR2(50), 
	"FIRSTNAME" VARCHAR2(20), 
	"LASTNAME" VARCHAR2(30), 
	"GROUPNAME" VARCHAR2(50), 
	 CONSTRAINT "TBLUSERPK" PRIMARY KEY ("LOGINNAME")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "RTRACK_DATA"  ENABLE
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "RTRACK_DATA"

It now works! Thanks VERY MUCH.

Carl
 
Primary Key Question

I noticed your example has
VB.NET:
 "PRIMARY KEY ("PREF_APP", "PREF_GROUP", "PREF_NAME")
"

and my code has CONSTRAINT
VB.NET:
"TBLUSERPK" PRIMARY KEY ("LOGINNAME")

The only place I found to enter a Primary Key was in the Constraint Tab, not the Index Tab as I would expect.

In the Index Tab, under Index Properties, Type, my only choices are B-Tree and Bitmap (not Primary Key).

Can you shed some light on this, hopefully, last question?

Thanks Again,
Carl
 
Indexes and primary keys are different things. A Primary Key is usually a not-null constraint that uses a unique index to ensure no duplicates. You can set multiple unique indexes on a table but never have a primary key on that table. Indexes merely provide an access to data lookup, they dont include a constraint. A constraint, by comparison, is a restriction. Hopefully this helps you see why a PK is a constraint, not an index. B-tree and Bitmap represent different ways of indexing rows. A discussion of the two methods is beyond the scope of this post, if you want to know more, please google for a suitable web page.

When using ODT to design a table I:

Add all the columns
Add a Constraint of type Primary Key set to use index: (Auto) 'it will create an index if no suitable one exists
Preview the SQL
Copy it into SQL Tools
Rearrange the column order of the primary key to my-wanted-order, not alphabetical-order (bug in my version of ODT)
Run the script
 
Last edited:
Last

Thanks cjard;

You've cleared up a few problems I was having by thinking I had a Primary Key. Thanks for explaining how you created your Primary Key.

Thanks Again,
Carl
 
Back
Top