vba - When using late-bound enumerated type is the only option to use the numeric representation of the type -
using late bound ado
code within vba
script i've got following:
dim cn object dim cm object dim rs object 'get in touch server 'create ado objects. set cn = createobject("adodb.connection") cn.open strconn cn.commandtimeout = 0 set cm = createobject("adodb.command") cm.commandtext = "xxx.dbo.xxxstoredprocname" set cm.activeconnection = cn cm.commandtype = 4 'adcmdstoredproc set rs = createobject("adodb.recordset") set rs.activeconnection = cn
i can see rs
recordset object line set rs = createobject("adodb.recordset")
without comment ('adcmdstoredproc
) i'd struggling remember cm.commandtype = 4
meant.
is there way change code can stick late binding use descriptive form of enumerated type commandtypeenum
rather numeric form?
put in declarations section of standard module
enum adcommandtypeenum adcmdunspecified = -1 adcmdtext = 1 adcmdtable = 2 adcmdstoredproc = 4 adcmdunknown = 8 adcmdfile = 256 adcmdtabledirect = 512 end enum
and work if bound. if go binding, make sure delete this.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms675946%28v=vs.85%29.aspx
Comments
Post a Comment