Page 1 of 1
Updating data
Posted: Sun 21 May 2006 13:55
by Oufti
Hello,
I explain the situation. I do a select from a table
I put the result in a DataTable via a DataAdapter and some TexTbox linked to the DataTable.
I can change the row with the CurrencyManager.
The "problem" I have. When I change a a field of a record and I save, all the record have the new value, not only the selected one, I use GetUpdateCommand.
To solve the problem, I use a MySQLCommand with an update query with in the where close the id of my record. That's work.
But I have to write a big query with a lot of parameters.
Is it not possible to make an update with in argument a DataRow (just a row) without fill fields one by one ?
Thanks,
Posted: Mon 22 May 2006 06:44
by Alexey
all the record have the new value, not only the selected one
What do you mean? A record has some fields and all of them get updated with new values? Please specify. Where these values came from?
Send us small test project if possible to reproduce the problem; it is
desirable to use 'test' schema objects, otherwise include definition of
your own database objects. Do not use third party components.[/quote]
Posted: Mon 22 May 2006 06:54
by Oufti
Alexey wrote:What do you mean? A record has some fields and all of them get updated with new values? Please specify. Where these values came from?
The data are in DataTable. Is it not possible to update one record (or more) without do an update query like this :
Code: Select all
UPDATE t_mytable SET
field1 = 'data_from_Datarow_1',
field2 = 'data_from_Datarow_2'
Imagine where there are 50 or more fields ....
But do something like in ORACLE PL/SQL, give in argument to query the DataRow and the query will update all the field for this record.
Thanks,
Posted: Mon 22 May 2006 08:13
by Alexey
There is an UpdateCommand property in MySqlDataTable component which you can change however you like. (The update statement is initially created when you configure your MySqlDataTable.)
Posted: Mon 22 May 2006 15:07
by Oufti
Alexey wrote:There is an UpdateCommand property in MySqlDataTable component which you can change however you like. (The update statement is initially created when you configure your MySqlDataTable.)
Yes, I know that. But I'd like pass in argument to a function to make an update, a DataRow of a DataTable for the specific record (DataRow), like this I won't have to write un SqlCommand with an update with a lot of fields.
Thanks,
Posted: Tue 23 May 2006 06:09
by Alexey
Please describe your function, table, specify what you want to perform.
Is it not possible to update one record (or more) without do an update query like this :
Code:
UPDATE t_mytable SET
field1 = 'data_from_Datarow_1',
field2 = 'data_from_Datarow_2'
It is possible if specify some criteria in WHERE clause.
Posted: Tue 23 May 2006 06:31
by Oufti
Alexey wrote:It is possible if specify some criteria in WHERE clause.
Really ?
Of course, I know it's possible. I'm trying an another solution, to do what I want.
Thanks,
Posted: Tue 23 May 2006 06:39
by Alexey
What you want is unclear for us. Please specify. And we will do our best.