🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database.dotnet
Article #666

Re: Accessing DataColumns in a strongly typed datasets

#666
From: Pravin Taneja
Date: Thu, 07 Oct 2004 03:49
45 lines
3372 bytes
> I know it has nothing to do with your problem but I simlpy have to ask how 
> did you create the strongly typed datasets? Did you use XSD.exe to 
> generate them out of an xsd-file and if so what is the parameter to create 
> a strongly typed dataset in Delphi?

Here are the steps-

assuming you are using Northwind database in MS Sql server-

-    Drop a SqlConnection component and set it ConnectionString property to 
something like 'server=localhost;database=Northwind;Trusted_Connection=True'
-    Drop a SqlDataAdapter component, set its selectCommand.Connection 
property to SqlConnection1, also set its SelectCommand.CommandText to 
'select * from Customers; select * from Orders'
-   Open SqlDataAdapter1.TableMappings collection editor from object 
inspector, map Table to Customers and Table1 to Orders, Click Ok
-    Right click on SqlDataAdapter1 and click Generate Dataset, type some 
name (CustomerOrder) for new dataset and ensure "Add this dataset to the 
designer" check box is selected.

Click ok, Delphi will do the rest for you. It will generate xsd file and a 
unit (CustomerOrderUnit.pas) that will include a desendant of DataSet. Its 
great work done and it can simplify coding efforts to a great extent.

I read this from Delphi for .Net Developer's Guide by Xavier Pacheco.

Visual Studio supports visually editing xsd file, adding new datatables, 
removing existing datatables, managing DataRelations etc. There is no visual 
support for it in Delphi, even generated xsd file is not added to the 
project group.


> I had a look after this information for a while but didn't find it. But I 
> read that this private-public problem is a bug that is still to be fixed. 
> So the only option in the moment seems to generate the classes and then 
> stop touching them since you have to change them everytime you create them 
> anew.

I wouldn't mind if Delphi lets me change the generated file (for the sake of 
using DataColumn names directly and avoiding run time overhead). But any 
changes done to the file are lost when you recompile your project. Its same 
as using persistent TFields in normal delphi DataSet  (<= D7) and not being 
able to use Table1Field1.AsString just because it is declared as private.

Pravin 
Technical Details
Message-ID: <4164bd4f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4164087d@newsgroups.borland.com> <41645e06@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,b9b82e63a6a89559
X-Google-Attributes: gid1effe6,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Pravin Taneja" <pravin@intellisoftwares.com.sg>
From: "Pravin Taneja" <pravin@intellisoftwares.com.sg>
Newsgroups: borland.public.delphi.database.dotnet
References: <4164087d@newsgroups.borland.com> <41645e06@newsgroups.borland.com>
Subject: Re: Accessing DataColumns in a strongly typed datasets
Date: Thu, 7 Oct 2004 11:49:04 +0800
Lines: 47
Organization: Intelli Softwares
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 218.186.22.123
Message-ID: <4164bd4f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1097121103 218.186.22.123 (6 Oct 2004 20:51:43 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail