Article View: borland.public.cppbuilder.database.dbexpress
Article #97ApplyUpdates giving mysql syntax error
From: Paul Betteridge
Date: Mon, 23 Aug 2004 12:34
Date: Mon, 23 Aug 2004 12:34
70 lines
3208 bytes
3208 bytes
Hi,
I have a form where I have a TSQLConnection, TSQLClientDataSet, TDataSource
and a TDBCtrlGrid (contain DBMemo controls).
The connection is made as follows and I can connect to the database and the
data can be viewed in the grid memo controls:
SQLConnection->LoginPrompt = false;
SQLConnection->ConnectionName = "MySQLConnection";
SQLConnection->DriverName = "MySQL";
SQLConnection->GetDriverFunc = "getSQLDriverMYSQL";
SQLConnection->Params->Clear();
SQLConnection->Params->Add("DriverName=MySQL");
SQLConnection->Params->Add("HostName=" +
AnsiString(MYSQL_SERVER_HOSTNAME));
SQLConnection->Params->Add("Database=" + AnsiString(GSERVER_DATABASE));
SQLConnection->Params->Add("User_Name=" + AnsiString(USERNAME));
SQLConnection->Params->Add("Password=" + AnsiString(PASSWORD));
SQLConnection->Params->Add("BlobSize=-1");
SQLConnection->Params->Add("ErrorResourceFile=./DbxMySqlErr.msg");
SQLConnection->Params->Add("LocaleCode=0000");
SQLConnection->LibraryName = "dbexpmysql.dll";
SQLConnection->VendorLib = "libmysql.dll";
// "user" is the name of my MySQL Table
ClientDataSet->CommandText = "select * from user;";
// we need to set the Connection and the Dataset
ClientDataSet->DBConnection = SQLConnection;
DataSource->DataSet = ClientDataSet;
// Activate Everything
SQLConnection->Connected = true;
ClientDataSet->Active = true;
DataSource->Enabled = true;
// this will connect the Datasource to DBGrid, which in turn will
// display the data, of the table
DBGrid->DataSource = DataSource;
I make the change to the memo control during runtime and call the following:
ClientDataSet->ApplyUpdates(0); // I have also tried
ApplyUpdates(-1);
and I get the following error:
You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near '; set
username = 'belliez'
where
id = '36' and
username
I can manually write SQL and send itto the mySql server with no problems.
If you know of any reason why I can't get ApplyUpdates to work then please
let me know asap.
I am using Borland C++ Builder 6 Professional
MySql server is 4.0.20a and I am using the latest dll for this version and
have been added into this project.
Many thanks
Paul
Technical Details
Message-ID:
<4158fcc0.0408230434.7d7b3425@posting.google.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: fb4e2,c0a4fea2535bfbde,start X-Google-Attributes: gidfb4e2,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews2.google.com!not-for-mail From: pbetteridge@abprecision.co.uk (Paul Betteridge) Newsgroups: borland.public.cppbuilder.database.dbexpress Subject: ApplyUpdates giving mysql syntax error Date: 23 Aug 2004 05:34:14 -0700 Organization: http://groups.google.com Lines: 70 Message-ID: <4158fcc0.0408230434.7d7b3425@posting.google.com> NNTP-Posting-Host: 81.31.99.179 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1093264455 2475 127.0.0.1 (23 Aug 2004 12:34:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 23 Aug 2004 12:34:15 +0000 (UTC)