excel - object doesn't support named arguments -
i'm writing vba code write data sql server, there no problem connection., when debug code in record set part system throws
runtime error 446 object doesn't support named arguments
here code
`sub copyfromdatabase() dim conn adodb.connection dim recordconn adodb.connection set conn = new adodb.connection set recordconn = new adodb.connection conn.connectionstring = "provider=sqloledb.1;integrated security=sspi;persist security info=true;data source=ph03\historian;use procedure prepare=1;auto translate=true;packet size=4096;workstation id=ocg;use encryption data=false;tag column collation when possible=false;initial catalog=historianstorage" conn.open 'on error goto closeconnection recordconn .activeconnection = conn .source = "connectiontable" .locktype = adlockreadonly .cursortype = adforwardonly .open end on error goto closerecord worksheets.add range("a2").copyfromrecordset recordconn closerecord: recordconn.close 'closeconnection: conn.close end sub`
help me!!
dim recordconn adodb.connection set recordconn = new adodb.connection
should be
dim recordconn adodb.recordset set recordconn = new adodb.recordset
Comments
Post a Comment