Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO basics 1

Status
Not open for further replies.

safra

Technical User
Jan 24, 2001
319
NL
After looking at the BDE I am now trying to figure out how to work with ADO.

I am trying to show the records of a paradox file in a dbgrid. With the BDE you can connect directly from a TTable to a table. With ADO it seems you first have to create a Data Source (after selecting Microsoft OLE DB Provider for ODBC Drivers) and then you can connect to it through a Data Link file or Connection String. I have searched for information about this but I still can't figure what this Data Source exactly is and how you can create it?

Is there anyone who can help me with this?

Thanks,
Raoul

 
A Ttable or Tquery is a non-visual object, it is the representation of the data stored in a table (access, paradox, interbase etc..) sometimes referred to as a dataset.

The visual components like dbgrid, dbedit, dblookup etc. are handled by user input and the show the results of some operation (show, edit, delete)

The link between the two components is the datasource

table/query --> datasource --> dbgid(or other visal data aware component)


If you scroll in the table the datsource sends a signal to the visual component to update its value. When editing via visual component, the datasource notifies the table or query that the current record has been changed.

Hope this helps

Steven van Els
SAvanEls@cq-link.sr
 
Yes thank you for helping. I am not referring to the TDatasource component.

What I mean is the datasource in the datalink properties:

1. Select ConnectionString property in TADOTable
2. select 'Use Connection String' > Build
3. Provider Tab > Microsoft OLE DB Provider for ODBC Drivers
4. Connection Tab > 1. Specify the source of the data options are:

- Use data source name or
- Use connection string

I do not understand how to continue from here.

Hope anyone can help me with this.
 
Thanks Nojathome,

I think I have seen it, it deals with ADO and a access database. If I am right they select 'Microsoft Jet 4.0 OLE DB Provider' in the Provider tab of the Data Link Properties. The Connection tab has different properties with this provider. I tried to use it with a paradox table but got errors. I think I have to select the 'Microsoft OLE DB Provider for ODBC Drivers' for Paradox but also for this part I am not sure??

Still can't figure out how to get this to work?
 
Why are you using ado with paradox?
Paradox is a Borland product, just like delphi and the BDE. The two are optimized for use. With the BDE you will get the most of paradox.
I have using the BDE with access, interbase, paradox and even oracle despite all the talks about that the BDE is out of date.

Steven van Els
SAvanEls@cq-link.sr
 
Ado is geared to be used by microsoft products like access and sql server.

Steven van Els
SAvanEls@cq-link.sr
 
ADO is MADE by microsoft (...[peace]...)

one rule : don't use Delphi ADO components in conjunction with ODBC, use OLEDB instead : you get better performance and you can have dynamic access to your tables (ODBC is always static)

cheers,

 
Safra,

You need to select:
- Use Connection String
- (suggest) Machine data source
- Select existing source from the list or create a new one as appropriate.

Steven,

IMHO given Safra's situation I would use ADO/ODBC in preference to the BDE.

The BDE is depreciated and a pain in the butt to distribute. Furthermore, when Safra's application is overwhelmed by is own success and he has to upgrade to SQL Server, the BDE will limit both performance and utilisation of the database's full facilities, but by then he would be stuck with it.

Use of Paradox nowadays implies modest data volumes. Agree ODBC will give worst performance, but, unless Safra's client is using very old computers, that worst performance will be perfectly acceptable.

Whosrdaddy,

Are you implying that you can connect ADO --> Paradox without using ODBC? If so how? It would certainly be useful.

Regards to all
Simon
 
Simon,

I only said that it's better to use ADO in conhjunction with OLEDB. since OLEDB is only available (to my humble knowledge) to microsoft products (access,sql server,...). so the answer is no. anyway for paradox you'll the best performance with the BDE...

safra, to answer your first question : NO you don't have to create an ODBC datasource IF you have a microsoft db product. don't use paradox with ADO [flush2]

 
Ok.... where shall I start...

Around 2 months ago I started with delphi and databases. The first tutorials I found were related to the BDE and Paradox which made it kinda obvious I went that way. Now 2 months further and reading more often that the BDE perhaps is not the way to go (once again stipulated by VintageWine in this thtead) I believe I have to go for ADO.

From all your input it seems I also have to drop Paradox when using ADO or can I use Paradox without much pain as there is an option Microsoft Paradox Driver in the ODBC Data Source options?

Thanks VintageWine, for pointing out the steps to take. I think I did something similar but without succes and I thought you had to somehow add the table(s) to the data source before being able to use it. But now it is working.

Is it only possible to create a ODBC data source manually or can this be done through delphi (this with respect to making things easy for the end user)?

To avoid problems in a later stage, the program I am working on is for small businesses and should work in a network environment. Will ADO be able to handle this?

Thanks for the help
 
>Is it only possible to create a ODBC data source manually >or can this be done through delphi (this with respect to >making things easy for the end user)?

You can get Installshield to do it. Alternatively you could try the following link.


>To avoid problems in a later stage, the program I am >working on is for small businesses and should work in a >network environment. Will ADO be able to handle this?
Yes

Reading between the lines, why don't you consider using Access, or even MSDE instead of Paradox? You will find ADO/Access much more satisfactory than ADO/Paradox or BDE/Paradox. My view of ADO/Paradox may differ from Whosrdaddy's, but he makes some valid points.

Good luck
Simon
 
Thanks VintageWine,

The link returns a 'session timed out' error.

I do want to try access. But at this point I get errors when trying to create an access table using the Delphi Database Desktop.

When I select MSACCESS as the table type I get an error. When I select Microsoft Access Driver I, the dialog box for creating a table appears but when trying to save it, it says:

Chosen Alias is not of type Microsoft Access Driver (*.mdb)





 
The problem with msaccess products is that by every upgrade you will get screwed by errors forcing you to re-install or remove something. I have been using paradox, access and interbase and if you are considering a network version of your application with msaccess be aware that you will need to do things that require more knowledge on the level of the Operating System.

I have one Interbase server, started with Win-95, now it is running on XP and a backup on Windows 2000.

The client applications run on any Micro$oft OS with just the plain BDE.
The only thing I do:
1) Install the BDE
2) Define the alias
3) Install interbase client
4) Copy the application files

..and things are running

That is the hard way, if I don't use the installation disk I have made with installshield.

All these embedded wizards things in M$ products just screw things up. What works today good in Access version xx, probably won't work if you upgrade the OS or the office suite.

Steven van Els
SAvanEls@cq-link.sr
 
>I do want to try access. But at this point I get errors >when trying to create an access table using the Delphi >Database Desktop.
An Access database is one large file. The tables are managed within it. Therefore, to create a table you first need a database. I don't think that Database Desktop can create Access Databases. It has to be said that a copy of Access is handy when developing against Access databases.

>if you are considering a network version of your >application with msaccess be aware that you will need to >do things that require more knowledge on the level of the >Operating System.
That implies my clients are in big danger. I have networked Access apps running live. I connect up using Delphi ADO components. For installation I ensure machines have MDAC 2.5 SP2 or later (and skip that stage for clients that are 100% XP), then just copy the Access database (.MDB file). What do I need to do to????????

>The problem with msaccess products is that by every >upgrade you will get screwed by errors forcing you to re->install or remove something.
I develop on Win 2000, test on Win 98 and clients run on 98/2000/XP. No grief.
Any doubts about a machine, run Microsoft's MDAC Component checker (free download) (Hopefully this link is persistent <g>)

>The link returns a 'session timed out' error.
Sorry it was a link to another newsgroup, but it seems the ids were for my session, not the article itself. If you want to go down that route search for SQLConfigDataSource.

Steven is now suggesting you go client-server and use Interbase. That route certainly has its merits, but how about the Delphi Interbase components in preference to the BDE.

I bet you are now throughly bewildered, Safra. :) Which database for Delphi: there is no one right answer, but there certainly are some wrong ones.

Good luck
Simon
 
> I bet you are now throughly bewildered, Safra. :)

;-)

Thanks, next time I will think again before asking something... Especially that last sentence...

> there is no one right answer, but there certainly are some wrong ones.

But all of this is kinda crucial. I belief all of you have chosen at some stage for a specific database solution in Delphi.

I think I have an old copy of access 98 somewhere. Will that get me somewhere or is it heavily outdated and not recommended to create the database this way or is there another way to do this?

 
let me put it from my point of view /experience :

for small projects (1 or 2 client machines), I use Access.
for bigger projects, where we have client/server environment, MS SQL server and or Oracle Dbengine are more appropriate. Like vintageWine said, there is no best/wrong answer. but there are certainly some good ones , like paradox/BDE, MSACCESS/ADO, SQL SERVER/ADO. but this doesn't mean that you have to use them in this combination...

concerning your access 98 (??isn't that 97) question. I would say everything starting from access 97 is OK. I developed a LOT of apps with '97 version and they are still used today. some apps were transisioned to access 2000 , with no problems.I repeat this just MY 2 cents & experience...

 
The database desktop can be used for quick and dirty paradox and dbase tables, without having the whole paradox/dbase Development engine. I cannot be used to manipulate access tables.
Make the tables in access, I think you do not need Access installed on the target machine, just the tables and your executable application. (Difficult to prove because all the computers I know have Access installed)

Remember paradox, access, sql server, interbase are all independent database systems, you cannot use them for word processing or as a spreadsheet (at least they where not developped to do that).

Delphi is a programming tool that can talk to databases among many other things.

I suggested to use Interbase if you are going for a client-server environment (my preference), but that implies also another aproach to database handling compared to desk-top systems like access and paradox.

The Interbase components in delphi work fine (of course they are both Borland products) and are interacting directly with the Interbase API, no BDE needed, you have access to everything in Interbase, you could even create your own IbConsole.

The drawback: they work only with Interbase, If you are using these components and you have to store your application data on any other system (oracle, sql-server, my-sql, postgress etc..), you need to rewrite your application. The BDE is much more flexible, and when used rational and with the differences of the various systems in mind, porting to another system could only be recreating the data on another DB platform, and changing the alias in the BDE administrator.

The question which system is best, is very difficult because we have all our own preferences.

Regards

Steven van Els
SAvanEls@cq-link.sr
 
I definetely will look at the client-server environment in the future. But at this stage I think I will head in the direction of ADO. Then the next stage is chosing a database. From this thread I get that it better not to use Paradox with ADO. I got it working but I don't know about the pitfalls. Anyway I just found the access disks (97) and see if that gets me somewhere. I would think you don't need access on the target machine... but I hope someone can confirm this as it is this kind of things I would like to avoid.

Thanks for all your help!
Raoul



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top