Hi Roland,
When you fetch data from SQL Server, ADO.NET does not default to fetching information about Primary Key, ReadOnly, AllowDBNull, MaxLength, and AutoIncrement. You can use the FillSchema to retrieve that information.
da.FillSchema(MyDataSet, SchemaType.Source, "MyTable")
da.Fill(MyDataSet, "MyTable")
>Hi
>
>Windows Form and vb.net (Framework Properties)
>
>How do you control the grid so that it uses the allow null, default values and field types and sizes from the Sql Database Table?
>
>When I add a record to the grid it seems to ignore the information from the Sql Database Table. Puts in
almost in every field.
>
>On smaller sized fields with length of less than 7 is seems not to put in a value and works wtih the AddNew record without an error message of Column 'MlsOfficeId' does not allow nulls. Do you want to correct the value?
>
>The grid put the value into the field in the first place. In SQL query the field shows nothing (varchar with the length of 0) and allownulls not checked.
>
>Why is the grid putting in values where they do not belong?
>
>
>Thanks
>Roland
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi