Reading Parameter Size from Schema

V

Vayse

Is it possible to read the size of a field from the schema?
For examle, I am running a query

Dim stSQL As String = "UPDATE Assets SET StatusID = ? WHERE AssetCode = ?"
Dim commandAsset As New OleDbCommand(stSQL, connAsset)
commandAsset.Parameters.Add("@AssetCode", OleDbType.VarChar, 6).Value =
stAssetCode
commandAsset.Parameters.Add("@StatusID", OleDbType.VarChar, 1).Value =
conSTATUS_DISPOSED


Now, instead of using 6 and 1 as the field size, I'd like to read it from
the schema. AssetsDataSet.xsd is the schema and Assets is the table.
The AssetCode will be used a lot, so I was thinking I could read its size
once at the start, then use it throughout the project. Store in a global
variable or My.Settings, or something like that.

Thanks
Vayse
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top