|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reading Parameter Size from SchemaFor 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 Vayse,
I don't know anymore what the metadata contains. http://msdn2.microsoft.com/en-us/library/system.data.common.dbdatareader.getschematable.aspx See here a sample how to use it. http://www.vb-tips.com/default.aspx?ID=49f2cff5-56ad-44fc-a4c6-fc0d5c470f53 I hope this helps, Cor
Other interesting topics
|
|||||||||||||||||||||||