selena1
Programmer
- Apr 7, 2003
- 69
I have a Paradox teble with next fields:
ID_member.................AUTOINC (Primary Key)
LastName...................CHAR(50)
FirstName...................CHAR(50)
On the form I use: DataSource, Query, DBGrid and DBNavigator. I have set SQL property of the Query component like:
"SELECT * FROM Members"
Everything work fine until I sort records. I change SQL property so that have value:
"SELECT * FROM Members ORDER BY LastName"
Now I get DataSet that I can't edit, insert or delete (read only). So I tried to use component UpdateSQL. I have set properties of Query components on next values: CachedUpdates = True, RequestLive = True, SessionName = Default and UpdateObject = UpdateSQL1.
Also, I have set property Modify of UpdateSQL1 component:
"UPDATE Members SET LastName = :LastName, FirstName = : FirstName"
I have wrote OnUpdateRecord event of Query component:
"if( UpdateKind = ukModify ) then
begin
UpdateSQL1.Apply(UpdateKind);
UpdateAction := uaApplied;
end;"
Also I have OnCreate event of Form component:
"Query1.Open;
Query1.Database.TransIsolation := tiDirtyRead;"
I col updates with click event of button:
"Query1.Database.ApplyUpdates( [Query1] );"
All the time I get a mistake: "UPDATE FAILED".
CAN ANYBODY HELP ME, PLEASE?
ID_member.................AUTOINC (Primary Key)
LastName...................CHAR(50)
FirstName...................CHAR(50)
On the form I use: DataSource, Query, DBGrid and DBNavigator. I have set SQL property of the Query component like:
"SELECT * FROM Members"
Everything work fine until I sort records. I change SQL property so that have value:
"SELECT * FROM Members ORDER BY LastName"
Now I get DataSet that I can't edit, insert or delete (read only). So I tried to use component UpdateSQL. I have set properties of Query components on next values: CachedUpdates = True, RequestLive = True, SessionName = Default and UpdateObject = UpdateSQL1.
Also, I have set property Modify of UpdateSQL1 component:
"UPDATE Members SET LastName = :LastName, FirstName = : FirstName"
I have wrote OnUpdateRecord event of Query component:
"if( UpdateKind = ukModify ) then
begin
UpdateSQL1.Apply(UpdateKind);
UpdateAction := uaApplied;
end;"
Also I have OnCreate event of Form component:
"Query1.Open;
Query1.Database.TransIsolation := tiDirtyRead;"
I col updates with click event of button:
"Query1.Database.ApplyUpdates( [Query1] );"
All the time I get a mistake: "UPDATE FAILED".
CAN ANYBODY HELP ME, PLEASE?