-2

I'm using TableAdapterManager, TableAdapter, BindingSource and DataSet for my record editor form. I would like to automate as many checks as possible. For example I want to know if field X has the "not null" option or not. If so, I can run the associated input filter at application level for the corresponding TextBox's Text property. (For example trimming white-spaces, checking after for equality with empty string, ...)

  • Visual Studio 2010
  • Microsoft SQL Server 2005
3
  • I think a look at this question will pay off: stackoverflow.com/questions/887370/…
    – mklein
    Nov 8, 2011 at 13:52
  • That solution is tightly bound to SQL server kind. May or may not work with another. These properties should appear at application level somehow, I think.
    – Notinlist
    Nov 8, 2011 at 14:04
  • More precisely: Why do I have the ADODB layer? I should not be doomed to raw SQL commands if I want to know if a field has the not null option or not.
    – Notinlist
    Nov 8, 2011 at 14:16

1 Answer 1

0
DataRow dr = ((DataRowView)table1BindingSource.Current).Row;
int maxlen = dr.Table.Columns["field1"].MaxLength;
bool allownull = dr.Table.Columns["field1"].AllowDBNull;
// ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.