Bug in dbExpress driver for MySQL 3.0
Bug in dbExpress driver for MySQL 3.0
I downdoaded the evaluation copy about a month ago and developed my application. I do not know the version number.
I just registered a few days ago and updated my system with the registered version 3.0. Now my tClientDataSet.edit commands no longer work. When I try to post, I get the error 'Unable to find record. No key specified'.
I would be happy to supply additional information if needed. My app is broke until this is resolved. Please help.
Thank you,
Jim Maurer
Northstar Data Systems
I just registered a few days ago and updated my system with the registered version 3.0. Now my tClientDataSet.edit commands no longer work. When I try to post, I get the error 'Unable to find record. No key specified'.
I would be happy to supply additional information if needed. My app is broke until this is resolved. Please help.
Thank you,
Jim Maurer
Northstar Data Systems
We couldn't reproduce the problem.
Please send us (dbxMda*crlab*com) a complete small sample to demonstrate it, including script to create and fill table.
Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of dbxMda.
- Exact version of MySQL server and MySQL client.
Please send us (dbxMda*crlab*com) a complete small sample to demonstrate it, including script to create and fill table.
Also supply us following information
- Exact version of Delphi, C++ Builder or Kylix
- Exact version of dbxMda.
- Exact version of MySQL server and MySQL client.
In my application I use your library to connect to mySQL servers. Most of the work is done using dynamically created components, additionaly working on threads. Only the DataSource for the localview is added to the form.
I have my own object TDBConnector. In its constructor I create a sql_db which is type of TSQLConnection. Then if I want to query a database I use the following code:
Until now everything works ok. Now the update record problem. To do this I call the following code:
The FVariant variable passed to the provider.ApplyUpdates is the local dataset Delta passed as FPub_ResultClientDataSet.Delta.
Unfortunately during the ApplyUpdates I receive the "Unable to find record. No key specified" error. It seems that the Delta doesn't know anything about the ProviderFlags := plflKey; which are set for the appropriate fields in the FPub_ResultClientDataSet (local) dataset.
I've also tried the upWhereAll UpdateMode for the provider, but it returns the "Record not found" error (which is strange, depending on that all fields are passed to the WHERE clause of the UPDATE sql). The upWhereChanged is unsufficient (too many records can fit the rule).
I hope I've given you enough information to solve the problem or to help me to solve the problem by my side.
I have my own object TDBConnector. In its constructor I create a sql_db which is type of TSQLConnection. Then if I want to query a database I use the following code:
Code: Select all
sql_query := TSqlQuery.Create(nil);
sql_query.SQLConnection := sql_db; // an instance of the TSQLConnection class
sql_query.SQL.Text := FParam2;
provider := TDataSetProvider.Create(nil);
provider.DataSet := sql_query;
// ... some other unimportant code here (exception handlin, etc.)
// then I create a local dataset, which I use to present data in the XDBGrid.
FPub_ResultClientDataSet := TClientDataSet.Create(nil);
FPub_ResultClientDataSet.Active := false;
FPub_ResultClientDataSet.SetProvider(provider);
FPub_ResultClientDataSet.Active := true;
// ... some other unimportant code here (exception handlin, etc.)
// now I've got the dataset so, the provider is freed
FPub_ResultClientDataSet.SetProvider(nil);
provider.Free;
sql_query.Free;
Code: Select all
sql_table := TSqlTable.Create(nil);
sql_table.SQLConnection := sql_db;
sql_table.TableName := FParam2;
// ... some other unimportant code here (exception handlin, etc.)
provider := TDataSetProvider.Create(nil);
provider.UpdateMode := upWhereKey; // or upWhereAll or upWhereChanged
provider.DataSet := sql_table;
provider.ResolveToDataSet := false;
// ... some other unimportant code here (exception handlin, etc.)
FPub_ResultVariant := provider.ApplyUpdates(FVariant, -1, FPub_ResultInteger);
provider.Free;
sql_table.Free;
Unfortunately during the ApplyUpdates I receive the "Unable to find record. No key specified" error. It seems that the Delta doesn't know anything about the ProviderFlags := plflKey; which are set for the appropriate fields in the FPub_ResultClientDataSet (local) dataset.
I've also tried the upWhereAll UpdateMode for the provider, but it returns the "Record not found" error (which is strange, depending on that all fields are passed to the WHERE clause of the UPDATE sql). The upWhereChanged is unsufficient (too many records can fit the rule).
I hope I've given you enough information to solve the problem or to help me to solve the problem by my side.
-
- Posts: 4
- Joined: Thu 10 Nov 2005 13:49
Did you set in the TSQLDataset's TField definitions (NOT TClientDataSet) the pfInKey flag in Providerflags? Icannot see it in your code. The borland driver uses to set this flag, but I think the corelab's one doesn´t.
Something like that
Maybe i´m wrong but this is a common issue in dbexpress newsgroup. It works for me and I´m using dbxmda!
Good luck!
(sorry about my terrible english
Something like that
Code: Select all
sqldataset.fieldbyname('pkfield').ProviderFlags:=[pfInUpdate,pfInWhere,pfInKey];
Good luck!
(sorry about my terrible english
