Probelm with 'MaxLength' property of Columns collection

Probelm with 'MaxLength' property of Columns collection

Post by Nader Mitr » Wed, 16 Apr 2003 03:27:40



Probelm with 'MaxLength' property of Columns collection
I.E.:
DataSet12.Tables(0).Columns(1).MaxLength

always return -1.
i have a text field in Microsoft access database i want to
know it's maximum length when i used the maxlength
property it always giving me -1
please help

 
 
 

Probelm with 'MaxLength' property of Columns collection

Post by dip » Wed, 16 Apr 2003 03:38:17


The DataAdapter.Fill method does not return the MaxLength
information by default. You will have to call
DataAdapter.FillSchema or set
DataAdapter.MissingSchemaAction to AddWithKey.

- dip

Quote:>-----Original Message-----
>Probelm with 'MaxLength' property of Columns collection
>I.E.:
>DataSet12.Tables(0).Columns(1).MaxLength

>always return -1.
>i have a text field in Microsoft access database i want
to
>know it's maximum length when i used the maxlength
>property it always giving me -1
>please help

>.


 
 
 

1. DataGrid's Columns collection, AutoGenerateColumns property, DataTable's

It seems that the DataGrid's Columns collection is filled only when
AutoGenerateColumns property is false...

Is this the expected behaviuor ? or is it a bug ?

if this is expected , how can I change the format of a DataGrid column using
code ?

sample code below :

***********************************************************


<html>
<head>
</head>
<body>

<script language="VB" runat="server">

Sub Page_Load(Source As Object, E As EventArgs)

     Dim oDS As New DataSet

     oCommand = New ADODataSetCommand("SELECT * FROM TestTable", "DRIVER
={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("test.mdb"))
     oCommand.FillDataSet(oDS, "TestTable")
     DataGrid1.DataSource = oDS.Tables("TestTable").DefaultView
     DataGrid1.DataBind()
     MyLabel.Text = "6>> DataGrid1.Columns.Count : " &
DataGrid1.Columns.Count

End Sub

</script>
     DataGrid's Columns collection not populating demo<br><br>
     <asp:Label id="MyLabel" runat="server"/><br><br>
     <asp:DataGrid id="DataGrid1" AutoGenerateColumns="true" runat
="server"/>
</body>
</html>
***********************************************************

thanks,

Rolando


   ICQ# 20081317

EBEL International Per
   http://www.ebelint.com

2. loading a MENU in a win32 program using API and Borland C++

3. TextBox's MaxLength property

4. Mirror 2D Convolution kernel?

5. about TextBox' property "MaxLength"

6. Need Help with Stop Error

7. The MaxLength property of a multiline textbox doesn't work

8. embeddedVB drop off when it start to use the emu

9. 'Collection' is ambiguous in the namespace 'VBA'

10. Column name 'Translate' causes 'Unspecified Error' when updating.

11. Error when converting MaximumValue property of 'RangeValidator7' to type 'Date'.

12. VB.NET Property 'Font' is 'ReadOnly' - Please Help!!

13. property 'item' is 'ReadOnly'