如何确定通过OleDb的MS Access字段大小 [英] How to determine MS Access field size via OleDb

查看:142
本文介绍了如何确定通过OleDb的MS Access字段大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在现有的应用程序是在C#。在启动过程中应用程序调用一个虚拟的方法来进行更改数据库(例如一个新的修订可能需要计算一个新的领域或某事)。一个开放的OLEDB连接被传递到方法。

The existing application is in C#. During startup the application calls a virtual method to make changes to the database (for example a new revision may need to calculate a new field or something). An open OleDb connection is passed into the method.

我需要更改字段宽度。 ALTER TABLE语句工作正常。但我想,以避免执行ALTER TABLE语句,如果字段已经是适当的大小。有没有一种方法来确定使用相同的OLEDB连接一个MS Access字段的大小?

I need to change a field width. The ALTER TABLE statement is working fine. But I would like to avoid executing the ALTER TABLE statement if the field is already the appropriate size. Is there a way to determine the size of an MS Access field using the same OleDb connection?

推荐答案

不知道如果我理解你的但问题彻底。结果
你可以查询该表为0行(SELECT 1 FROM myTable的其中1 = 0)

Not sure if I understand your question completely.
But you could query the table for 0 rows (SELECT 1 FROM myTable WHERE 1= 0)

和可以使用recordet的领域收集,请参阅该字段按名称或索引
和使用领域的财产,如大小,类型等结果。

And you could use recordet's field collection, refer to that field by name or index and use field's property like size, type etc.

帮助吗?

这篇关于如何确定通过OleDb的MS Access字段大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆