vbscript - ADODB reference from an HTA application -


i need hta application shows data mdb using ado technology.

here's how code starts:

function getdata() dim pathname pathname = "d:\\wp\\ado\\adoexamples.mdb" dim con 'as new adodb.connection dim rs 'as new adodb.recordset set rs = new adodb.recordset rs.cursortype = adopenstatic rs.locktype = adlockoptimistic set con = new adodb.connection 

i error:

class undefined adodb. 

apparently, it's because need include adodb references. how do in .hta file?

you can't create ado objects way in vbscript. use createobject() instead:

pathname = "d:\\wp\\ado\\adoexamples.mdb" dim con 'as new adodb.connection dim rs 'as new adodb.recordset set rs = createobject("adodb.recordset") rs.cursortype = adopenstatic rs.locktype = adlockoptimistic set con = createobject("adodb.connection")

also, vbscript doesn't recognize ado named constants adopenstatic or adlockoptimistic, need define them yourself:

const adopenstatic     = 3 const adlockoptimistic = 3 

or use numeric value.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -