发 帖  
原厂入驻New

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

2009-1-8 10:13:15  2513
分享
<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>
0
2009-1-8 10:13:15   评论 分享淘帖
1 个讨论
编程好像好难哦<br/>
2009-12-2 13:44:07 评论

举报

只有小组成员才能发言,加入小组>>

135个成员聚集在这个小组

加入小组

创建小组步骤

关闭

站长推荐 上一条 /7 下一条

快速回复 返回顶部 返回列表