Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2003, 06:24 AM
Authorized User
 
Join Date: Jun 2003
Location: Crowland, Lincs, United Kingdom.
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting Field Size in DataSet

I know that you can get information about type of any field in the Dataset Table, but any one know can you access information about the field size as well, for example field A is System.String and has 30 chars long, when asking - it should return value of 30

Thanks in advance
kasie
 
Old June 30th, 2003, 02:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Wien, Wien, Austria.
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Code:
    public int GetColumnLength(DataColumn dc)
    {
        if (dc.DataType.ToString()=="System.String")
        {
            return (int) dc.MaxLength;
        }
        else
        {
            return 0;
        }
    }


...but the Soon is eclipsed by the Moon




Similar Threads
Thread Thread Starter Forum Replies Last Post
How create a DBF db and set size of a field Dormarth VB Databases Basics 2 May 30th, 2006 06:06 AM
maximum size of HTML form field crmpicco HTML Code Clinic 4 April 24th, 2006 05:14 AM
Any Limitations on the Size of Dataset??? Dilip Nagle ASP.NET 1.0 and 1.1 Professional 2 December 21st, 2005 02:44 PM
size of the dataset returned aldwinenriquez ASP.NET 1.0 and 1.1 Professional 0 July 6th, 2005 04:43 AM
Alter FIeld Size And Scale fastcorvette Access 3 December 17th, 2003 06:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.