Solved

missing parameter type

Posted on 2001-08-12
1
679 Views
Last Modified: 2007-12-19
Hi,

Got a missing parameter type for this function below:
function GetDataType(Table1.FieldDefs[i].DataType:string):TFieldType ;

Any suggestions?
0
Comment
Question by:rhapsody7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 21

Accepted Solution

by:
gemarti earned 5 total points
ID: 6377591
I don't think you can convert a datatype to a string.

Try this:

place a datasource, table, button and a standard listbox on a form

attach the table to a database and link the datasource then run this application:

NOTE: Since this q is only worth 5 points I am not including all of the datatypes available in this code. You'll have to do that yourself:

--------------cut below this line--------------------------

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, DBTables, DBCtrls, Mask, ExtCtrls;

type
  TForm1 = class(TForm)
    DataSource1: TDataSource;
    Table1: TTable;
    Button1: TButton;
    ListBox1: TListBox;
    procedure FormActivate(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.FormActivate(Sender: TObject);
var
  i : integer;
begin
  for i := 0 to Table1.FieldList.Count -1 do
    //begin
      ListBox1.Items.Add(Table1.FieldList.Strings[i]);
    //end;
end;

procedure TForm1.ListBox1Click(Sender: TObject);
var
  Fname : String;
  i : Integer;
begin
  i := ListBox1.ItemIndex;
  Fname := ListBox1.Items.Strings[i];
  Case Table1.Fields.FieldByName(FName).DataType of
  ftUnknown: ShowMessage('FtUnknown: Unknown or undetermined');
  ftString: ShowMessage('ftString: Character or string field');
  ftSmallint: ShowMessage('ftSmallInt: 16-bit integer field');
  ftInteger: ShowMessage('ftInteger: 32-bit integer field');
  ftWord: ShowMessage('ftWord: 16-bit unsigned integer field');
  ftBoolean: ShowMessage('ftBoolean: Boolean field');
  ftFloat: ShowMessage('ftFloat: Floating-point numeric field');
  ftCurrency: ShowMessage('ftCurrency: Money field');
  ftBCD: ShowMessage('ftBCD: Binary-Coded Decimal field that can be converted to Currency type without a loss of precision.');
  ftDate: ShowMessage('ftDate: Date field');
  ftTime: ShowMessage('ftTime: Time field');
  ftDateTime: ShowMessage('ftDateTime: Date and time field');
end;

end.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 91
Mobile Keyboard covers the display of the TMemo 3 102
Create a path if not exists 7 107
Delphi and Access based Enumeration 9 77
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question