| 发表于:2007-04-03 19:17:42 楼主 |
strcurdate = sheet2.range( "d2 ").value2 if len(strcurdate) = 0 then strcurdate = cstr(now) end if dim strcomparemonth as string strcomparemonth = sheet2.range( "d3 ").value2 convertratio = sheet2.range( "h2 ").value dim dbserver as string dim dbuser as string dim constring as string dbserver = thisworkbook.customdocumentproperties( "dbserver ") dbuser = thisworkbook.customdocumentproperties( "dbuser ") dbpassword = thisworkbook.customdocumentproperties( "dbpassword ") constring = "provider=sqloledb.1;data source= " & dbserver & _ ";user id= " & dbuser & _ ";password= " & dbpassword & _ ";initial catalog=cnsmsq3;connection reset=false; " set con = new adodb.connection con.connectionstring = constring con.commandtimeout = 300 'secs con.open dim para1 as adodb.parameter set cmd = new command cmd.activeconnection = con cmd.commandtimeout = 300 cmd.commandtype = adcmdstoredproc set para1 = cmd.createparameter( "@convertratio ", addouble, adparaminput, , cdbl(convertratio)) cmd.parameters.append para1 set para2 = cmd.createparameter( "@currentdate ", addate, adparaminput, , cdate(strcurdate)) cmd.parameters.append para2 if len(strcomparemonth) > 0 then set para3 = cmd.createparameter( "@comparestartdate ", addate, adparaminput, , cdate(strcomparemonth)) cmd.parameters.append para3 end if set rs = new adodb.recordset rs.activeconnection = con rs.open "set nocount on " ' refresh report data cmd.commandtext = "uspfinancedailysales " rs.open cmd, , , , adcmdstoredproc with worksheets( "report ").range( "a6 ").querytable set .recordset = rs .refresh backgroundquery:=false end with rs.close 提示出错,report的querytable不存在,然后在excel中利用导入外部数据添加了querytable,但还是出错,总是在.refresh那一句出错 通过querytables.add添加querytabe, 也总是refresh出错。 已经搞了两天了,救命啊 |
|
|
|
|