dim as 和set =他们有什么区别?
比如:
dim cn as new adodb.connection
set conn = new adobo.connection
同样是定义,他们有什么区别么?
比如:
dim cn as new adodb.connection
set conn = new adobo.connection
同样是定义,他们有什么区别么?
解决方案 »
- LOGFONT的lfFaceName无效
- Adodc.Recordset.RecordCount 实时错误'91' ,对象变量或with 块变量未设置(在线等)
- 可以在运行时隐藏sstab 的选项卡头吗?
- 如何通过代码获取数据库当中表的字段名呢??
- vb中如何生成一个word文档
- 有谁能帮我解决用Vb将数据存入Excel表,请高手指点!急!急!
- 请教!!!!!各为大哥帮忙阿
- vb向crystal report 传递参数时的问题
- 现在学到VB6.0的文本和图像处理,花了我好多时间
- 快来看,绝对的超值!源码大放送,时间只有一个月了,你还不快点!
- TreeView 的checkbox的问题
- 如何读取MSCOMM控件缓存区中的数据?
char * p="12345"; char *p;
p="12345";
Set obj = New Class 则立即创建对象,但是obj必须提前声明为Class型的变量,如:
Dim obj As Class
两者都是前期绑定
等同于
dim cn as adodb.connection
set cn = new adodb.connection
if cn is nothing then set cn = new adodb.connection
所以通常不推荐使用 dim ... as new ...。下面的两段代码可以看出不同
(一)
dim cn as adodb.connection
debug.print cn is nothing
set cn = new adodb.connection
debug.print cn is nothing
set cn = nothing
debug.print cn is nothing
(二)
dim cn as new adodb.connection
debug.print cn is nothing
'set cn = new adodb.connection
'debug.print cn is nothing
set cn = nothing
debug.print cn is nothing