编程论坛
400万+工程师在用
华为|鸿蒙开发者日
直播报名
400万+工程师在用
华为|鸿蒙开发者日
直播报名

电子发烧友网工程师

17年用户 16436经验值
擅长:可编程逻辑 MEMS/传感技术 测量仪表 模拟技术 控制/MCU RF/无线
私信 关注

ActualSize 和 DefinedSize 属性应用实例(VB)

2009-1-8 10:13

<p><font face="Verdana">本范例使用 ActualSize 和 DefinedSize 属性来显示字段的定义大小和实际大小。</font></p>
<p><font face="Verdana">Public Sub ActualSizeX()</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; Dim rstStores As ADODB.Recordset<br/>&nbsp;&nbsp;&nbsp; Dim strCnn As String</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; ' Open a recordset for the Stores table.<br/>&nbsp;&nbsp;&nbsp; strCnn = "Provider=sqloLEDb;" &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Data Source=srv;Initial Catalog=Pubs;User Id=sa;Password=; "<br/>&nbsp;&nbsp;&nbsp; Set rstStores = New ADODB.Recordset<br/>&nbsp;&nbsp;&nbsp; rstStores.Open "stores", strCnn, , , adCmdTable<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ' Loop through the recordset displaying the contents<br/>&nbsp;&nbsp;&nbsp; ' of the stor_name field, the field's defined size,<br/>&nbsp;&nbsp;&nbsp; ' and its actual size.<br/>&nbsp;&nbsp;&nbsp; rstStores.MoveFirst</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; Do Until rstStores.EOF<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox "Store name: " &amp; rstStores!stor_name &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vbCr &amp; "Defined size: " &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rstStores!stor_name.DefinedSize &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vbCr &amp; "Actual size: " &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rstStores!stor_name.ActualSize &amp; vbCr<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rstStores.MoveNext<br/>&nbsp;&nbsp;&nbsp; Loop</font></p>
<p><font face="Verdana">&nbsp;&nbsp;&nbsp; rstStores.Close</font></p>
<p><font face="Verdana">End Sub<br/></font></p>

回帖(1)

langxing

2009-12-2 13:44:07
编程好像好难哦<br/>

更多回帖

打开APP