Article View: borland.public.cppbuilder.database.ado
Article #2123Re: TADOTable and data-aware components, or TADO Command?
From: Mark Guerrieri
Date: Sun, 09 Nov 2003 02:55
Date: Sun, 09 Nov 2003 02:55
55 lines
3230 bytes
3230 bytes
I've had success using ADO with MySQL (4) and the ODBC provider, using
TADOQuery.
1- Make sure your table has a primary key, and make sure you include this in
the query.
2- If using Edit() / Post(), I've had no problems using
DataSet->FieldByName("DateField")->AsDateTime
3- If using parameterized queries, assign dates to parameters as strings,
using TDateTime::FormatString to format the string to a MySQL recognizable
date type.
Mark
"Jason Shrapnel" <jason@invarion.com> wrote in message
news:3faacfde@newsgroups.borland.com...
> Hi there,
>
> I'm trying to figure out the best way to interface between a client
> application and a mysql server using ADO. I have tried using TADOTables
with
> data-aware components to automate the posting process - ie using TADOTable
> methods Edit(), Insert(), and Post(). Unfortunately I encountered many
> problems using this method, specifically when I tried to post Date values.
>
> Another method I have tried was to use the TADOCommand component and build
> SQL query strings based on what the user is doing then passing that string
> through to the server. This seems to work well but involves a great deal
> more coding and huge modifications to the existing program structure.
>
> As I have little experience working with ADO I was hoping someone could
give
> me advice on which is the best option to choose given the above
information.
> If a solution was found to overcome the problem with posting Date values
> using the TADOTable component (or some other component that allows
> data-aware editing components to connect to it) then that might be the
> preferred option.
>
> Currently the MYSQL table I am using is of type InnoDB. I have tried using
> TimeStamp, DateTime, and Date field types to post the date. Using the
> TimeStamp field I receive an E_Fail exception if any of the TimeStamp
fields
> have blank data (the TimeStamp field does not allow null values for some
> reason). Using the DateTime and Date fields, I receive "Row cannot be
> located for updating" errors, although the row is definately available.
>
> I am using MDAC 2.6 and MYSQL 4.0.16 running on a Win2k Server.
>
> Any advice or help that can be offered would be appreciated,
>
> Thankyou,
> Jason
> Invarion Pty Ltd
>
>
Technical Details
Message-ID:
<3fadac99$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3faacfde@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,576fb9af2138d9fa X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-11-08 19:09:06 PST From: "Mark Guerrieri" <markg11@comcast.net> Newsgroups: borland.public.cppbuilder.database.ado References: <3faacfde@newsgroups.borland.com> Subject: Re: TADOTable and data-aware components, or TADO Command? Date: Sat, 8 Nov 2003 21:55:31 -0500 Lines: 57 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 68.45.79.46 Message-ID: <3fadac99$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1068346521 68.45.79.46 (8 Nov 2003 18:55:21 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail