Re: moving record in datagrid
From: Earl (brikshoe_at_newsgroups.nospam)
Date: 11/26/04
- Next message: Magne Ryholt: "How to display a windows form as a control ?"
- Previous message: joeycalisay: "Re: Persist values entered in Designer?"
- In reply to: C. Vidal: "moving record in datagrid"
- Next in thread: C. Vidal: "Re: moving record in datagrid"
- Reply: C. Vidal: "Re: moving record in datagrid"
- Reply: C. Vidal: "Re: moving record in datagrid"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 26 Nov 2004 01:55:43 -0500
Kinda reminds me of the question, how high is "up". By what criteria does a
row exist in a "higher" or "lower" position exist in a table in your
database? Theory would say none at all. BUT, the results from your database
can be determined by sort order. So the seminal question becomes: what field
do you want to sort by?
Obviously the "rows" in a datagrid have to be ordered by one of the fields.
So the task becomes to change THAT field value for one or more rows, then
have the value change in the datagrid saved to the database.
So it sounds like you are saying:
Row ID Animal
1 1 Dog
2 2 Cat
3 3 Bird
etc.
Assuming you sort on ID. Let's say you want the Cat to be Row 1, so you have
to change the ID field value of Dog and the ID value of Cat to 1. But can
you really do so? That ID will likely either be a foreign key or a primary
key. If it's an autogenerated PK, then you cannot change it at all. If it's
a FK, then you have to change the value in the related table -- again,
likely not an easy task to assure you would get the result you are looking
for. Thus it appears that the only solution would be to create a "display
priority" field where the user assigns the priority of the record in the
datagrid and then saves all the records back to the database after
"priority" changes are made.
"C. Vidal" <cvidal_nospam@univer-com.com> wrote in message
news:OI5bqmi0EHA.2804@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I have a datagrid with some columns which is binfind to a dataset.
> I would like the users can move the rows as they want in the datagrid and
> save this change in the database.
> How can i do this?
> I may be find a solution to move records in the datagrid but i don't know
> how save the order in the database.
>
> (in the table, I have a field which contains the begin order)
>
> Thanks in adavance.
>
> C. Vidal
>
> PS : sorry for my bad english
>
- Next message: Magne Ryholt: "How to display a windows form as a control ?"
- Previous message: joeycalisay: "Re: Persist values entered in Designer?"
- In reply to: C. Vidal: "moving record in datagrid"
- Next in thread: C. Vidal: "Re: moving record in datagrid"
- Reply: C. Vidal: "Re: moving record in datagrid"
- Reply: C. Vidal: "Re: moving record in datagrid"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|