Solved

missing parameter type

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month5 days, 23 hours left to enroll

627 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