C#:带有内置组件的数据库反射

发布于 2024-12-14 10:13:33 字数 269 浏览 3 评论 0原文

我使用 TableAdapterManager、TableAdapter、BindingSource 和 DataSet 作为我的记录编辑器表单。我想自动化尽可能多的检查。例如我想知道字段 X 是否有“not null”选项。如果是这样,我可以在应用程序级别为相应的 TextBox 的 Text 属性运行关联的输入过滤器。 (例如修剪空格、检查是否与空字符串相等……)

  • Visual Studio 2010
  • Microsoft SQL Server 2005

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰火雁神 2024-12-21 10:13:33
DataRow dr = ((DataRowView)table1BindingSource.Current).Row;
int maxlen = dr.Table.Columns["field1"].MaxLength;
bool allownull = dr.Table.Columns["field1"].AllowDBNull;
// ...
DataRow dr = ((DataRowView)table1BindingSource.Current).Row;
int maxlen = dr.Table.Columns["field1"].MaxLength;
bool allownull = dr.Table.Columns["field1"].AllowDBNull;
// ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文