Getting Table Schema
From: Mac Davis (newsgroups_at_blindsided.org)
Date: 03/27/05
- Next message: Barak zabari: "Re: RecordIndex out of range ?"
- Previous message: Sudianto Atek: "RecordIndex out of range ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 26 Mar 2005 22:04:03 -0500
Two quick questions -
1) The Datatype ftString return a length on e greater than the field size
in SQL server. Is that because it is returning the size of the string
rather than the size of the field?
2) The following snippet is triggered by clicking on a table name in a list
box. It works fine with five of the seven tables. However, on the other
two tables,
the line FieldSize := adoquery1.Fields[i].DataSize; causes an error (List
Index out of bounds) only on the last field. The last field type is
SQLServer nvarchar.
if I comment out that line, then the fieldtype and fieldname are properly
reported.
Or
If I change the first line to FieldCount-2 then there is no error.
Any suggestions or explanation would be appreciated.
for i:= 0 to qry.FieldCount - 1 do begin
stName := qry.Fields [i].FieldName;
dt := qry.Fields[i].DataType;
FieldSize := adoquery1.Fields[i].DataSize;
stName := PadString (12,stName);
stType := Field_Type (dt);
if dt = ftString
then stSize := inttostr(Fieldsize - 1)
else stSize := inttostr(FieldSize);
stSize := Padsize (2,stSize);
listbox1.items.add (stName + ' - ' + stSize +'...'+ stType);
end;
-dmd-
If the obvious weren't so obscure, I'd be less confused.
- Next message: Barak zabari: "Re: RecordIndex out of range ?"
- Previous message: Sudianto Atek: "RecordIndex out of range ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|