Solved

missing parameter type

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

16 Experts available now in Live!

Get 1:1 Help Now