Error 3001 vba Excel Macros MySQL Insert -
im trying insert row in mysql db using excel macros. connection appears working ok vba 3001 error
(microsoft visual basic 3001 arguments of wrong type, or out of acceptable range, or in conflict 1 another)
when y execute code:
dim rs adodb.recordset set rs = new adodb.recordset connectdb 'strsql = "insert talar.ots (ubicaciontecnica, equipo, posmant) values ('sdasd', 'sdasd','sdasd')" rs.open strsql, oconn, adopendynamic, adlockoptimistic
i allready read , try different things 50 tutorials , other posts in page, bad results....
this code of connection:
private sub connectdb() dim oconn adodb.connection set oconn = new adodb.connection oconn.open "driver={mysql odbc 5.2 unicode driver};" & _ "server=localhost;" & _ "database=talar;" & _ "user=root;" & _ "password=root;" & _ "option=3" end sub
mysql odbc 5.2 unicode driver installed, mysql service running fine, using excel 2010, windows 7. dont know if information enough. have idea? thanks!
oconn
local connectdb
sub passing nothing recordsets open
.
add option explicit
top of code file receive warning when this.
make function returns connection:
private function connectdb() adodb.connection set connectdb = new adodb.connection connectdb.open "driver={mysql odbc 5.2 unicode driver};server=localhost;database=talar;user=root;password=root;option=3" end function
then
dim cn adodb.connection set cn = connectdb() cn.execute "insert talar.ots (ubicaciontecnica, equipo, posmant) values ('sdasd', 'sdasd','sdasd')" cn.close
you not need recordset
insert no rows returned.
when need recordset
adopenforwardonly, adlockreadonly
better adopendynamic, adlockoptimistic
unless need features offered latter.
Comments
Post a Comment