DataGrid problem – Very urgent. 
Author Message
 DataGrid problem – Very urgent.

Hi,

Im using Access 2000 database.
Im creating table at run time using INSERT INTO statement.

Im using DataGrid to view this table, and ADO 2.7 recordset.

My problem is sometimes (I still cant tell exactly when) when Im trying
to edit a record, I get an error: Key column information is insufficient or
incorrect. Too many rows were affected by update.

I will be very grateful if someone will help understand this.

Thanks,
Tal.



Sat, 05 Jun 2004 02:42:06 GMT  
 DataGrid problem – Very urgent.


Fri, 19 Jun 1992 00:00:00 GMT  
 DataGrid problem – Very urgent.
This is due to the table you are referencing does not have a primary key or
unique key defined.  The grid control doen not know what field to update out
of a possible of 2+ rows in the table.

I would take a look at the table and assign either an autonumber or have
some system setup so that you know that you have a unique key defined.

Hope this helps,

Shawn Mettler, MCSD, MCT


Quote:
> Hi,

> I'm using Access 2000 database.
> I'm creating table at run time using "INSERT INTO " statement.

> I'm using DataGrid to view this table, and ADO 2.7 recordset.

> My problem is - sometimes (I still can't tell exactly when) when I'm
trying
> to edit a record, I get an error: "Key column information is insufficient
or
> incorrect. Too many rows were affected by update."

> I will be very grateful if someone will help understand this.

> Thanks,
> Tal.



Sat, 05 Jun 2004 03:36:42 GMT  
 DataGrid problem – Very urgent.
Thanks, this is the problem.

I added the table primary key and now it's working.
But - it's working only when I'm selecting the primary key in the SQL
Statement.

Do I  must select the primary key?
What if I do not want to display it?


Quote:
> This is due to the table you are referencing does not have a primary key
or
> unique key defined.  The grid control doen not know what field to update
out
> of a possible of 2+ rows in the table.

> I would take a look at the table and assign either an autonumber or have
> some system setup so that you know that you have a unique key defined.

> Hope this helps,

> Shawn Mettler, MCSD, MCT



> > Hi,

> > I'm using Access 2000 database.
> > I'm creating table at run time using "INSERT INTO " statement.

> > I'm using DataGrid to view this table, and ADO 2.7 recordset.

> > My problem is - sometimes (I still can't tell exactly when) when I'm
> trying
> > to edit a record, I get an error: "Key column information is
insufficient
> or
> > incorrect. Too many rows were affected by update."

> > I will be very grateful if someone will help understand this.

> > Thanks,
> > Tal.



Sat, 05 Jun 2004 17:56:35 GMT  
 DataGrid problem – Very urgent.
You may be able to make the column width 0.


Quote:
> Thanks, this is the problem.

> I added the table primary key and now it's working.
> But - it's working only when I'm selecting the primary key in the SQL
> Statement.

> Do I  must select the primary key?
> What if I do not want to display it?



> > This is due to the table you are referencing does not have a primary key
> or
> > unique key defined.  The grid control doen not know what field to update
> out
> > of a possible of 2+ rows in the table.

> > I would take a look at the table and assign either an autonumber or have
> > some system setup so that you know that you have a unique key defined.

> > Hope this helps,

> > Shawn Mettler, MCSD, MCT



> > > Hi,

> > > I'm using Access 2000 database.
> > > I'm creating table at run time using "INSERT INTO " statement.

> > > I'm using DataGrid to view this table, and ADO 2.7 recordset.

> > > My problem is - sometimes (I still can't tell exactly when) when I'm
> > trying
> > > to edit a record, I get an error: "Key column information is
> insufficient
> > or
> > > incorrect. Too many rows were affected by update."

> > > I will be very grateful if someone will help understand this.

> > > Thanks,
> > > Tal.



Sat, 05 Jun 2004 20:48:48 GMT  
 DataGrid problem – Very urgent.


Quote:
> Thanks, this is the problem.

> I added the table primary key and now it's working.
> But - it's working only when I'm selecting the primary key in the SQL
> Statement.

> Do I  must select the primary key?

Yes. Suppose your primary key consists of 4 parts and you use 2 parts in the
DataGrid.
Now suppose further that your grid is updated.

How is the grid supposed to update the table? It does not know the 2 columns
not selected

For example suppose your table consists of

Col1    Col2     Col3    Col4    Description
1           1          2         3         "Row 1"
1           1          2         4         "Row 2"
1           1          2         5         "Row 3"

where Col1,Col2, Col3,Col4 are collectively a unique Primary Key

You decide you want to display just Col1,Col2 and Description in your Grid
You update the descriptions

Now with the Grid looking like

Col1    Col2     Description
1           1         "New Description1"
1           1         "New Description2"
1           1         "New Description3"

how is the grid supposed to "know" which grid row maps to the table?
It can no longer can map the information back to the unique primary key
because it does not have it record anywhere

Quote:
> What if I do not want to display it?

Then don't, just make sure that the grid has it somewhere.

Stephen Howe



Sun, 06 Jun 2004 00:15:18 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. DataGrid problem – Very urgent.

2. Datagrid problem - Urgent!

3. URGENT : Width datagrid columns problem resize

4. DataGrid Problem- Urgent

5. Need some help with DataGrids (DataGrid-->DataGrid, DataGrid-->Dataset, DataGrid-->XML)

6. DataGrid Validation URGENT!!!

7. DataGrid Guru( Urgent Reply Please)

8. URGENT!!- editing mutliple rows in a datagrid!!

9. URGENT - wierd behavior in DataGrid

10. DataGrid question (Urgent)

11. combox within datagrid --- need some urgent help

12. URGENT - wierd behavior in DataGrid

 

 
Powered by phpBB® Forum Software