Solved

missing parameter type

Posted on 2001-08-12
1
672 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now