Article View: borland.public.cppbuilder.database.ado
Article #3Re: ADOConnection, ADOTable, ADOQuery Basics
From: Clayton Arends
Date: Thu, 21 Feb 2008 16:27
Date: Thu, 21 Feb 2008 16:27
67 lines
3896 bytes
3896 bytes
"Sudesh" <sudeshc@vfemail.net> wrote in message
news:47b97333@newsgroups.borland.com...
> I hope this is correct NG to ask my questions.
It is. However, this question has been asked hundreds of times in the past.
Use a newsgroup search tool like google groups (http://groups.google.com)
and a search string of something like "borland ado insert record" as a
start.
> Can somebody please quickly guide me how to do the following?
> 1. Insert/delete/update records
If you want to use an easy visual interface then you can drop a TDBNavigator
on the form and hook it to the same datasource that you have hooked to your
grid and dataset. It has buttons for "Insert", "Edit", "Delete". After the
insert/edit operations you'll need to click "Post".
If you want to do these tasks in code there are methods of TDataSet (which
TADODataSet, TADOTable, and TADOQuery descend from):
// Adding a new record
ADODataSet1->Append();
// Set the values of your fields, there are various ways to do this
ADODataSet1->Fields->Fields[0]->Value = 1;
ADODataSet1->Fields->Fields[1]->AsInteger = 700;
ADODataSet1->FieldByName("Description")->Value = String("Example");
ADODataSet1->FieldValues["SomeField"] = Null();
// Save the changes
ADODataSet1->Post();
// Updating the current record
ADODataSet1->Edit();
// Set the values, use the same way as above
// Save the changes
ADODataSet1->Post();
// Deleting the current record
ADODataSet1->Delete();
> 2. Carry out SQL to filter records (and update DBGrid)
> something like below
One way is to use TADOQuery instead of TADOTable. Drop the TADOQuery
component on your form, hook into it just like you did before, set its SQL
property to whatever you want, open it (or set active to true) just like
TADOTable.
> 3. if application is to be deployed on another PC or network what is
> required?
The following packages are some of what you'll need. rtl, dbrtl, adortl,
vcl, and vcldb. Note, their names are different depending on the VCL
version you are using. They will have a 70 after their name in your case
(vcl70.bpl for example). You will also need the borlandmm.dll and
cc3270mt.dll. However, instead of relying on others here to tell you what
you'll need you should use tdump (do a google groups search to learn its
tricks) or a tool like dependency walker (http://dependencywalker.com).
These tools show you which dll/bpl files are used by the exe/dll.
If you build your exe standalone then you won't need to distribute anything
with your app (unless you have manually loaded DLLs). You may need to
download and install some ADO (OLE DB) drivers for the PC depending on what
DBMS you are attempting to connect to.
HTH,
Clayton
Technical Details
Message-ID:
<47bda663$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!62.111.101.3.MISMATCH!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<47b97333@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,a49b6386b1d150d4 X-Google-Attributes: gid10698b,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Clayton Arends" <nospam_claytonarends@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado References: <47b97333@newsgroups.borland.com> In-Reply-To: <47b97333@newsgroups.borland.com> Subject: Re: ADOConnection, ADOTable, ADOQuery Basics Date: Thu, 21 Feb 2008 08:27:07 -0800 Lines: 68 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6000.16480 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545 NNTP-Posting-Host: 68.185.45.89 Message-ID: <47bda663$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1203611235 68.185.45.89 (21 Feb 2008 08:27:15 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!62.111.101.3.MISMATCH!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail