PC Review


Reply
Thread Tools Rate Thread

How can i get the correct value of DataColumn.MaxLength

 
 
wjg
Guest
Posts: n/a
 
      15th Jul 2003
hi all:

My c# code like this , and just like here on Microsoft web site :
http://support.microsoft.com/default...;en-us;q317175


DataSet ds = new DataSet();
//myDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
myDataAdapter.Fill(ds, "Categories");
myDataAdapter.FillSchema(ds, SchemaType.Mapped);

DataTable mytable = ds.Tables["Categories"];
for (int i = 0; i < mytable.Columns.Count; i ++)
Console.WriteLine(mytable.Columns[i].MaxLength);


but DataColumn.MaxLength() does not work at all,
how can i do?
thanks!





 
Reply With Quote
 
 
 
 
Kathleen Dollard
Guest
Posts: n/a
 
      16th Jul 2003
Why did you comment out the MissingSchemaAction line? It is necessary to get
certain SQL information.

Kathleen


"wjg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hi all:
>
> My c# code like this , and just like here on Microsoft web site :
> http://support.microsoft.com/default...;en-us;q317175
>
>
> DataSet ds = new DataSet();
> //myDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
> myDataAdapter.Fill(ds, "Categories");
> myDataAdapter.FillSchema(ds, SchemaType.Mapped);
>
> DataTable mytable = ds.Tables["Categories"];
> for (int i = 0; i < mytable.Columns.Count; i ++)
> Console.WriteLine(mytable.Columns[i].MaxLength);
>
>
> but DataColumn.MaxLength() does not work at all,
> how can i do?
> thanks!
>
>
>
>
>



 
Reply With Quote
 
New Member
Join Date: Oct 2008
Posts: 1
 
      31st Oct 2008
Try to call FillSchema first before calling Fill method such as:

myDataAdapter.FillSchema(ds, SchemaType.Mapped);
myDataAdapter.Fill(ds, "Categories");
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataColumn.Min/MaxLength gerry Microsoft ADO .NET 6 16th Jun 2009 02:00 PM
Read/Write MaxLength and AllowDBNull in System.Data.DataColumn with Access Giorgio Microsoft ADO .NET 0 15th Dec 2006 03:09 PM
binding datacolumn to another datacolumn in a datagrid bpdace Microsoft C# .NET 0 23rd Nov 2005 03:59 PM
How to add a datacolumn which points to another datacolumn Programatix Microsoft ADO .NET 1 30th Jan 2005 04:12 PM
DataSet - DataColumn MaxLength =?Utf-8?B?cnBhcnJlbGxh?= Microsoft ADO .NET 1 22nd Oct 2004 03:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 PM.