Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recognizing memo fields in VFP
Message
From
16/04/2006 18:49:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
16/04/2006 18:46:30
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
01113940
Message ID:
01113969
Views:
18
>>Where do you get DataType? From DataColumn? It doesn't have a Length property. What I am saying is you can't decide checking string's length.
>
>Here are the two ways of getting the field length, either from a dataset or directly from a column:
>
>
>    ' Return the field length
>    ' expO1 DataSet
>    ' expC1 Table
>    ' expC2 Field
>    Public Shared Function GetFieldLength(ByVal toDataSet As DataSet, ByVal tcTable As String, _
>     ByVal tcField As String) As String
>        Dim loColumn As DataColumnCollection
>        loColumn = GetColumn(toDataSet, tcTable)
>        Return loColumn.Item(loColumn.IndexOf(tcField)).MaxLength
>    End Function
>
>    ' Return the field length by the use of a columns
>    ' expO1 DataSet
>    ' expC1 Table
>    ' expC2 Field
>    Public Shared Function GetFieldLengthFromColumn(ByVal toColumn As DataColumnCollection, _
>     ByVal tcField As String) As String
>        Return toColumn.Item(toColumn.IndexOf(tcField)).MaxLength
>    End Function
>
>
>
>GetColumn() is as follow:
>
>
>    ' Return the columns from a table
>    ' expO1 DataSet
>    ' expC1 Table
>    Public Shared Function GetColumn(ByVal toDataSet As DataSet, Optional ByVal tcTable As String = "Temp") _
>     As DataColumnCollection
>        Return toDataSet.Tables(tcTable).Columns
>    End Function
>
That's what I was afraid of. You're using MaxLength. Test it you'd get -1 for both char fields and memo field.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform