TField origin is often blank

Hi,

I need to find which table a field has come from, but using TADOQuery.fields[i].origin doesn't always work. Quite often if a table alias was used in the query then origin just returns blank. I have too many queries to go through and edit them all to never use aliases!

Does anyone have any ideas about how I can find out which table a particular field has come from?

Thanks
0
Stephen
11/28/2008 2:23:08 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

6 Replies
889 Views

Similar Articles

[PageSpeed] 0

> {quote:title=Stephen Branley wrote:}{quote}
> Hi,
> 
> I need to find which table a field has come from, but using TADOQuery.fields[i].origin doesn't always work. Quite often if a table alias was used in the query then origin just returns blank. I have too many queries to go through and edit them all to never use aliases!
> 
> Does anyone have any ideas about how I can find out which table a particular field has come from?
> 
> Thanks

I always proceed my field names with an identifier that tells me what table the belong to, eg. field CompanyName in table customers would be cust_CompanyName

Hope this helps in the future...

Cory
0
Cory
11/28/2008 2:30:19 PM
Hi Cory,

Thanks for the reply. I would do that, but this is a project I've inherited with hundreds of queries on hundreds of forms. I wanted to write a small form where I could select a given dataset and find out which table each field has come from. For the reason that you mention (no prefixes being used) this seems difficult!
0
Stephen
11/28/2008 2:51:33 PM
Stephen Branley skrev:
> Hi,
> 
> I need to find which table a field has come from, but using TADOQuery.fields[i].origin doesn't always work. Quite often if a table alias was used in the query then origin just returns blank. I have too many queries to go through and edit them all to never use aliases!
> 
> Does anyone have any ideas about how I can find out which table a particular field has come from?
> 
> Thanks

I have never used origin of TField but I understand from the help that 
it should contain TableName.FieldName.
It is also only implemented for BDE datasets again according to the help.

For ADO you can get the same using the recordset property and combine 
the values for the properties BASETABLENAME and BASECOLUMNNAME.

{code}
ADOQuery1.Recordset.Fields[i].Properties['BASETABLENAME'].Value
ADOQuery1.Recordset.Fields[i].Properties['BASECOLUMNNAME'].Value
{code}

regards

/Micke
0
Mikael
11/28/2008 2:56:05 PM
Wow, I'm impressed with the speed of responses around here!

I've tried ADOQuery1.Recordset.Fields[i].Properties['BASETABLENAME'].Value
and ADOQuery1.Recordset.Fields[i].Properties['BASECOLUMNNAME'].Value
but both only ever return null for me. I read some documentation about having to have certain types of cursor set, but we meet those criteria. I can't figure out why they are always null.

> {quote:title=Mikael Eriksson wrote:}{quote}
> Stephen Branley skrev:
> > Hi,
> > 
> > I need to find which table a field has come from, but using TADOQuery.fields[i].origin doesn't always work. Quite often if a table alias was used in the query then origin just returns blank. I have too many queries to go through and edit them all to never use aliases!
> > 
> > Does anyone have any ideas about how I can find out which table a particular field has come from?
> > 
> > Thanks
> 
> I have never used origin of TField but I understand from the help that 
> it should contain TableName.FieldName.
> It is also only implemented for BDE datasets again according to the help.
> 
> For ADO you can get the same using the recordset property and combine 
> the values for the properties BASETABLENAME and BASECOLUMNNAME.
> 
> {code}
> ADOQuery1.Recordset.Fields[i].Properties['BASETABLENAME'].Value
> ADOQuery1.Recordset.Fields[i].Properties['BASECOLUMNNAME'].Value
> {code}
> 
> regards
> 
> /Micke
0
Stephen
11/28/2008 3:10:19 PM
Also, I've just noticed:

ADOQuery.recordset.fields.count is 30 (as expected) but
ADOQuery.recordset.fields[i] is nil (for every value of i)

which strikes me as odd.

> {quote:title=Stephen Branley wrote:}{quote}
> Hi,
> 
> I need to find which table a field has come from, but using TADOQuery.fields[i].origin doesn't always work. Quite often if a table alias was used in the query then origin just returns blank. I have too many queries to go through and edit them all to never use aliases!
> 
> Does anyone have any ideas about how I can find out which table a particular field has come from?
> 
> Thanks
0
Stephen
11/28/2008 4:02:54 PM
> {quote:title=Stephen Branley wrote:}{quote}
> I've tried ADOQuery1.Recordset.Fields[i].Properties['BASETABLENAME'].Value
> and ADOQuery1.Recordset.Fields[i].Properties['BASECOLUMNNAME'].Value
> but both only ever return null for me. I read some documentation about having to have certain types of cursor set, but we meet those criteria. I can't figure out why they are always null.

It could depend on database and OLEDB provider.
MS SQL Server works fine. Visual Foxpro does not.
For VFP BASETABLENAME is populated when I don't use an alias in the query but when I use an alias BASETABLENAME is null.

regards

/Micke
0
Mikael
11/28/2008 5:24:22 PM
Reply:

Similar Artilces:

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Delphi 6 to Delphi 2010 upgrade and ADO
We have an application written in Delphi 6 Professional that uses ADO to access databases servers that may be on other PCs in our network. We want to move to Delphi 2010 but can't decide if we need Professional or Enterprise. 2010 Pro has dbGO - will this give us the same functionality as the ADO components we use in Delphi 6 Pro? Thanks, Keith > 2010 Pro has dbGO - will this give us the same functionality as the > ADO components we use in Delphi 6 Pro? Yes. > {quote:title=Joachim Uersfeld wrote:}{quote} > > 2010 Pro has dbGO - will this give us the same func...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

Delphi 5 with ADO
Hi I'm having some problems adjusting a Delphi5/MSSQL database application, which i did not wrote (what's more: i'm not a Delphi expert either) so i thought maybe someone in this comunity will enlighten me. It' about an SQL command which is issued by this delphi5 application (the sql command was traced in SQL server with profiler), but which is nowhere to be found in the souce code. I've searched already all the components which i knew that could issue the SQL command (TADOQuery, TADOCommand) but with no l uck. Could anyone tell me other misterious places where i shou...

ASA7, ADO and Delphi
Hello! I've got a problem with accessing a database via ADO with Delphi 5. Everytime I set the ADOConnection active I get the error "Invalid enum value". I'm using Delphi 5 Enterprise and ASA7 with EBF #449. Is there anybody who ever get an ADOConnection to ASA7 with Delphi 5? Gruesse, Matthias I'm using C++ Builder 5 and get the same problem. I've asked this question before and no one seems to be able to respond... Matthias Hovestadt wrote: > Hello! > > I've got a problem with accessing a database via ADO > with Delp...

Delphi + Long Binary + ADO
How can I update a long binary field in an ASA6 database using Delphi + ADO (not ADOExpress)? I have the blob in a string, but when trying to update the field, I get an "invalid variant conversion" error. If I re-type the field to a long varchar, the update seems to work, but I concerned that this may be affected by code page selection. Do I have to worry about raw bytes written to a long varchar not coming back in exactly the same form? From the database side of things, a LONG VARCHAR and LONG BINARY should be treated exactly the same way. I might try posting this ...

Blank subject, blank from
I have Bugzilla v3.1.4 set up on Windows 2003 server and it's running great. I needed 3.1.4 for the SMTP auth ability. The only problem is that the emails from Bugzilla arrive with blank subjects, and no 'from' address. I know that this information is on the server, because it is in the headers of the email: ....some stuff before here... Received: *redacted* for <*redacted*>; Tue, 30 Sep 2008 11:21:17 -0400 (EDT) From: bugzilla@*redacted* To:*redacted* Subject:[Bug 7] New:Receiving should print label after each lot is created X-Bugzilla- Reason:GlobalWatcher ...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

System.ADO with Delphi debugger.
By 2 or 3 days Delphi debugger D7 , D9 and DXE stops with a System ADO fatal error (irretrievable error), when the program sets to True the ADOConnection's connected property. If the executable program run outside IDE the error does'nt raise, but when it starts inside IDE with debug option the error raise and the program stops and don't open the desired connection. I tried to repair MDAC on my system (Win32 XP SP3), but the problem remain. What can I do to use the debugger into IDE? (I use Delphi since 11 years and this problem never raised). Studio Rubabno Chairman wrote: &...

Delphi, ADO, SQL Anywhere
This combination seem not to work together. I'm using D5 Enterprise, ASA 6.03 w/latest EBF On some tables it works. But most of the tables produce a message "An Error occured". As soon as data bound contols are used, the connection just gives errors. It seem to work fine, if I use client based cursors. But this option copys the server table to the local client. This is not acceptable for my large tables. It lasts several minutes on my pc. Are there plans to release a native OLE DB provider for ASA or at least to fix the ODBC driver so, that ADO can be used? I am very...

ADO not ADO.NET
Hi, I have to connect to a db using adodb (which i select from the references). I have to retrieve the car models from the database and bind them to a listbox. I am not sure how to proceed and I can't find any articles on ADO with .net and data binding. Here is the code that i tried but it only retrieves the car model for the specified id. If I delete the id it doesn't work. Also it writes the car model in the listbox vertically such as: B M W CODE: Imports System.Data Imports ADODB Imports System.Data.OleDb Public Class listboxADO Inherits System.Web.UI...

ADO to ADO.NET
I'm an ASP programmer (VBScript) moving on to ASP.NET. So far I'm using:Microsoft Visual Studio 2003ASP.NET with C#I'm working on converting my code over to C#, from VBScript. Now, here is my code in VBScript (modified to better understand it, this is a edited ugly version):Function ExecuteSQL(sqlStatement)    ConnDriver = "Provider=SQLOLEDB; Data Source = " & dbIP & "; Initial Catalog = " & dbName & "; User Id = " & dbUser & "; Password=" & dbPassword     Set connTemp = Server.CreateObject("ADODB.Connection")    c...

ASA8 and Delphi ADO? Is it work?
Anybody test this configuration? As i can remember ASA7 don't work with Delphi via ADO. ---------------------------------- Oleg Kovalevsky Moscow, Russia I haven't tested ASA8 with Delphi, but I'm using ASA7 with Delphi 5 and ADOExpress. There are some glitches, but ASA support has been very helpful with addressing the problems. On Fri, 29 Mar 2002 17:01:05 +0300, "Oleg Kovalevsky" <okovalevsky@hotmail.com> wrote: >Anybody test this configuration? As i can remember ASA7 don't work with >Delphi via ADO. > > >----------...

Delphi 2010, ADO and Datamodule
I installed Delphi 2010 on a Windows 7 x64. I have build a few applications using a datamodule and several Adodatasets, connecting to a SQL server. Until Delphi 2009 everything worked fine. When I open the project with 2010, I get an error, stating it can not find something, it probebly is not installed corectly. I tried reïnstalling without any succes. Projects with the sam AdO conecctions but no Datamodule run fine. Any sugestions? Regards, Kees Flipsen Kees Flipsen wrote: > I get an error, stating it can not find something, Do you really expect someone to be able...

Web resources about - TField origin is often blank - embarcadero.delphi.ado

Internet cafe
Explore Kai Hendry's photos on Flickr. Kai Hendry has uploaded 20565 photos to Flickr.

Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Photo Albums - Los Angeles Gas Prices
" /> Not Logged In Log In Sign Up Points Leaders Follow Us Facebook Twitter 4:45 AM Home Gas Prices Points & Prizes Forum Community Gas Price ...

A short course in project management - Project - Office.com
Microsoft Office Project 2007 Step by Step By Carl Chatfield and Timothy Johnson Carl Cha tfield is a certified Project Management Professional ...

Urban Dictionary: T: Tezuka to tfl
look up anything, like your city : word of the day dictionary thesaurus names media store add edit blog random A B C D E F G H I J K L M N O ...

Internet cafe
Explore Kai Hendry's photos on Flickr. Kai Hendry has uploaded 22280 photos to Flickr.

Internet cafe - Flickr - Photo Sharing!
Explore Kai Hendry's photos on Flickr. Kai Hendry has uploaded 20565 photos to Flickr.

Internet cafe - Flickr - Photo Sharing!
Explore Kai Hendry's photos on Flickr. Kai Hendry has uploaded 20565 photos to Flickr.

Internet cafe - Flickr - Photo Sharing!
Explore Kai Hendry's photos on Flickr. Kai Hendry has uploaded 22201 photos to Flickr.

Internet cafe - Flickr - Photo Sharing!
Explore Kai Hendry's photos on Flickr. Kai Hendry has uploaded 22280 photos to Flickr.

Resources last updated: 1/8/2016 4:31:52 PM