Article View: borland.public.delphi.database.dotnet
Article #669Re: Accessing DataColumns in a strongly typed datasets
From: Fingolfin
Date: Thu, 07 Oct 2004 21:27
Date: Thu, 07 Oct 2004 21:27
60 lines
4155 bytes
4155 bytes
"Pravin Taneja" <pravin@intellisoftwares.com.sg> schrieb im Newsbeitrag news:4164bd4f$1@newsgroups.borland.com... >> 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. Thanks for the information. But sadly it's not really what I'm looking for. With this approach I need to already have a database which I then change into a strongly typed dataset. Finally if the source-db changes I have to manually change the new generated dataset-unit anew. But I really would like to use an xsd (prefereably created with some good db-diagram-creation-tool with xsd export) which would then be the base of my typed dataset. Too bad. :( If you have any ideas on that matter I would be glad to hear them. > 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. Yeah, sadly. hey are one step ahead it seems. Well, let's hope for an update. >> 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. I feel your pain. :(
Technical Details
Message-ID:
<4165b4b3$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.moat.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4164087d@newsgroups.borland.com> <41645e06@newsgroups.borland.com> <4164bd4f$1@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: "Fingolfin" <Fingolfin_@gmx.net> From: "Fingolfin" <Fingolfin_@gmx.net> Newsgroups: borland.public.delphi.database.dotnet References: <4164087d@newsgroups.borland.com> <41645e06@newsgroups.borland.com> <4164bd4f$1@newsgroups.borland.com> Subject: Re: Accessing DataColumns in a strongly typed datasets Date: Thu, 7 Oct 2004 23:27:54 +0200 Lines: 62 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: 217.231.252.74 Message-ID: <4165b4b3$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1097184435 217.231.252.74 (7 Oct 2004 14:27:15 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.moat.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail