如何使用VB6.0从SQL DB检索ole对象 [英] HOW to retreive ole object from SQL DB using VB6.0

查看:182
本文介绍了如何使用VB6.0从SQL DB检索ole对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将OLEObject从SQL DB保存到物理文件(.doc)时,它会打开MS Word并显示错误
"word无法将主文档与数据源合并,因为数据记录为空"

使用以下代码:
OLE1.object.SaveAs strDir和"\"&strFileName&".doc"

需要在不打开任何内容的情况下静默保存它


请帮助

while saving OLEObject from the SQL DB to a physical file(.doc) it opens the MS Word and displays the error
"word could not merge the main document with the data source because the data records were empty"

Used the following code:
OLE1.object.SaveAs strDir & "\" & strFileName & ".doc"

Need to save it silently without opening anything


Please Help

推荐答案

>
VBARC写道:

word不能将主文档与数据源,因为数据记录为空

word could not merge the main document with the data source because the data records were empty


听起来像是邮件合并文档?是否有数据库连接到Word文档?

就目前而言,看起来Word文件已正确保存,并且在打开文档时MailMerge函数开始起作用.如果您保存空" Word文档,它是否可以正常工作?


Sounds like it''s a mailmerge document? Is there a database hooked up to the Word-document?

As it stands, it looks like the Word-file is saved correctly, and that the MailMerge function starts acting up when you open the document. Does it work correctly if you save an "empty" Word-document?


打开Word文档本身时会引发该错误.我认为其正在寻找数据源并查询客户端是什么已经有了.

因此,当将其设置为OLE本身时,将引发错误.

需要将其保存到物理文件中而不弹出错误.
When opening the Word document itself it throws that error.i think its looking for the datasource and querying what the client is having already.

So when assing that in to ole itself,throws the error.

Need save it in to physical file without popping up the error.


您可以将SaveAs语句放在Try Catch块中,如果发现错误,则不执行任何操作.唯一的缺点是,如果ANY错误阻止文件保存,也会跳过该文件,因此您可能需要添加一些内容来跟踪错误.等待...您正在使用VB6 ...我不确定它是否为Try Catch块...那么可能类似于On Error GoTO ...您将必须
You could put your SaveAs statement in a Try Catch block, then just don''t do anything if an error is caught. The only down side is that if ANY error prevents the file from saving it will be skipped as well, so you may want to add something to keep track of the error. Wait...you''re using VB6...I''m not sure it''s a Try Catch block then...it might be something like On Error GoTO...you''ll have to google[^].


这篇关于如何使用VB6.0从SQL DB检索ole对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆