Idispatch error #3079

unique88 2010-05-17 10:25:56
人在网上淘了一个程序,是关于仓库管理系统的,不过里面有几个功能实现不了,入库信息,出库信息,还库信息 这三个功能中的修改 删除 不好用。我在网上搜索了一下,貌似是数据有了问题,不知道哪位帅哥能给解答下。我感觉程序比较多,是否可以发到邮箱中,在你们的运行环境下帮忙调试一下,甚是感谢。有意者请留下邮箱,我会将其发到邮箱中 或是QQ在线指导下,非常着急。。。
...全文
363 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyq5945 2010-05-27
  • 打赏
  • 举报
回复
结贴提醒

如果您的问题已经得到解决,请您早日结贴,如四日后未结贴,该贴将做强制结贴处理。
如果您的问题尚未得到解决,请回复方便其他网友知道你仍关注该问题。如四日后没有其他网友和楼主本人回复,该贴将做强制结贴处理。
如果贴子只有楼主和强制结贴的版主本人回复,将按无满意结帖处理。

注:强制结贴版主本人将不会分配答题分
尹成 2010-05-17
  • 打赏
  • 举报
回复
你在这里把相关问题简要说明下,可以大家一起发表意见啊,然后你自己调改下这样印象会更深。
unique88 2010-05-17
  • 打赏
  • 举报
回复
恩 是呀 是否可帮忙呀?
Eleven 2010-05-17
  • 打赏
  • 举报
回复
毕业设计。。。。
unique88 2010-05-17
  • 打赏
  • 举报
回复
void CDlgViewDevIn::OnBtnVidel()
{
if (!UpdateData())
return;

CString sql_;
sql_.Format(CString("DELETE FROM DEVICE_IN WHERE in_date=")+DATEFMT, m_date);
_bstr_t sql = sql_;

try
{
m_DBCnt->Execute(sql, NULL, adCmdText);
}
catch(_com_error& e)
{
AfxMessageBox(e.ErrorMessage());
return;
}
MessageBox("完成操作!");
m_log->AddLog("删除入库信息");

RefreshData();
}其中DATEFMT在全局变量中定义为 #define DATEFMT CString("'%s'"),in_data是access数据库文件的中一个表的主键。该段程序主要是为了完成数据的删除,不过总是出现idispatch error#3079这个提示。大家帮忙研究下 ,我不是软件专业的,这个看的非常之费劲。。。
首先新建一个工程名称为ADO的基本对话框工程。然后: 1.在头文件stdafx.h 中加入 #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","rsEOF") 2.在ADODLG.cpp中加入 void CADODlg::OnBtnQuery() { CoInitialize(NULL); // 初始化COM环境 _ConnectionPtr conn(__uuidof(Connection)); // 创建连接对象 _RecordsetPtr rst(__uuidof(Recordset)); // 创建记录集 try { conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=691126" ,"", "", adModeUnknown); // 打开数据库并建立连接(有密码) //conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;" ,"", "", adModeUnknown); // 打开数据库并建立连接(没有密码) rst->Open(_variant_t("select * from sheet1"), _variant_t((IDispatch*) conn), adOpenDynamic, adLockOptimistic, -1); // 读取数据表 while(!rst->rsEOF) { ((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)rst->GetCollect("姓名")); // 查询"姓名"字段 rst->MoveNext(); } } catch(_com_error e) { CString errormessage; // 保存错误信息 errormessage.Format("Error: %s", e.ErrorMessage()); // 设置错误信息的格式 //AfxMessageBox(errormessage); // 以对话框的形式输出错误信息 MessageBox(errormessage,"错误提示"); } //MessageBox("查询结束!","提示",0); rst->Close(); conn->Close(); rst.Release(); // 释放相应COM接口上的引用计数 conn.Release(); CoUninitialize(); // 卸载COM环境库 }
用MFC 显示PPT //启动 PowerPoint: void CMainFrame::OnPowerpointStartpowerpoint() { /// Check if the IDispatch connection exists with PowerPoint, // if not create one. if (m_ppt.m_lpDispatch == NULL) { // Create IDispatch connection to PowerPoint. m_ppt.CreateDispatch("PowerPoint.Application"); }; // Bring the PowerPoint application to the front. m_ppt.Activate(); } void CMainFrame::OnPowerpointStartslideshow() { _Presentation oPresentation; SlideShowSettings oShow; // Attach to the Active Presentation. oPresentation.AttachDispatch(m_ppt.GetActivePresentation()); // Attach to the slide-show settings. oShow.AttachDispatch(oPresentation.GetSlideShowSettings()); // Run the slide show. oShow.Run(); } // 创建幻灯片: void CMainFrame::OnPowerpointCreateslide() { // Connect to the active presentation. There is no error trapping. // If the active presentation the framework traps // the error and displays a message box. _Presentation ActivePresentation(m_ppt.GetActivePresentation()); // Connect to the slides collection. Slides oSlides(ActivePresentation.GetSlides()); // This constant is defined in the PowerPoint Object model. // You can use the Object Browser, with Visual Basic Editor // (VBE), to look up the different constant values. const ppLayoutTitleOnly = 11; // Add a new slide to the presentation. This code adds the new // slide to the end of the presentation. oSlides.Add(oSlides.GetCount() + 1l, ppLayoutTitleOnly); } // 创建演示文稿: void CMainFrame::OnPowerpointCreatepresentation() { Presentations PresCollection; // Make sure there is a dispatch pointer for PowerPoint. if(m_ppt.m_lpDispatch == NULL) { // Display a message indicating that PowerPoint is not running. MessageBox("PowerPoint is not running.", "Start PowerPoint"); } else { // Bring PowerPoint to the front. m_ppt.Activate(); // Attach the presentations collection to the PresCollection // variable. PresCollection.AttachDispatch(m_ppt.GetPresentations()); // Create a new presentation. PresCollection.Add(1);
因文件超过20M不能上传,所以拆分为两个文件分次上传 第1章 COM背景知识 1.1 COM的起源 1.1.1 软件业面临的挑战 1.1.2 传统解决方案 1.1.3 面向对象程序设计方法 1.1.4 最终解决方案:组件软件 1.1.5 面向对象的组件模型——COM 1.2 COM的发展历程 1.2.1 COM以前的对象技术:DDE、OLE 1、VBX控件 1.2.2 COM首次亮相:OLE2 1.2.3 Microsoft拥抱Internet:ActiveX 1.2.4 更多的新名词:Windows DNA和COM+ 1.2.5 远程对象:ORBs和DCOM 1.2.6 COM的最新版本:COM+ 1.3 COM技术现状 1.3.1 COM与CORBA 1.3.2 COM与Enterprise Java Beans 1.3.3 Windows之外的COM 小结 第2章 从C++到COM 2.1 C++客户重用C++对象——例程DB 2.1.1 C++对象 2.1.2 客户程序 2.2 将C++对象移进DLL中——例程DB_cppdll 2.2.1 成员函数的引出 2.2.2 内存分配 2.2.3 Unicode/ASCII兼容 2.2.4 例程实现 2.2.4.1 修改接口文件 2.2.4.2 修改对象程序 2.2.4.3 修改客户程序 2.3 C++对象使用抽象基类——例程DB_vtbl 2.3.1 问题:私有数据成员被暴露 2.3.2 解决方案:抽象基类 2.3.2.1 什么是抽象基类(Abstract Base Class) 2.3.2.2 实现秘诀:虚函数(Virtual Functions) 2.3.3 使用抽象基类 2.3.4 例程实现 2.3.4.1 修改接口文件 2.3.4.2 修改对象程序 2.3.4.3 修改客户程序 2.4 改由COM库装载C++对象——例程dbalmostcom 2.4.1 COM库 2.4.2 对象创建的标准入口点 2.4.3 标准对象创建API 2.4.4 标准对象注册 2.4.5 例程实现 2.4.5.1 修改接口文件 2.4.5.2 修改对象程序 2.4.5.3 修改客户程序 2.5 将C++对象变成COM对象 2.5.1 引用计数 2.5.2 多接口 2.5.3 IUnknown接口 2.5.4 标准类厂接口:IClassFactory 2.5.5 对象代码的动态卸载 2.5.6 自动注册 2.5.7 例程实现 2.5.7.1 修改接口文件 2.5.7.2 修改对象程序 2.5.7.3 修改客户程序 2.6 为COM对象添加多接口支持 2.6.1 多接口 2.6.2 DEFINE_GUID 2.6.3 例程实现 2.6.3.1 修改接口文件 2.6.3.2 修改对象程序 2.6.3.3 修改客户程序 小结 第3章 COM基础知识 3.1 对象与接口 3.1.1 COM对象 3.1.2 COM接口 3.1.3 IUnknown接口 3.1.3.1 生存期控制:AddRef和Release 3.1.3.2 接口查询:QueryInterface 3.1.4 全球唯一标识符GUID 3.1.5 COM接口定义 3.1.6 接口描述语言IDL 3.2 COM应用模型 3.2.1 客户/服务器模型 3.2.2 进程内组件 3.2.3 进程外组件 3.2.4 COM库 3.2.5 HRESULT返回值 3.2.6 COM与注册表 3.3 COM组件 3.3.1 实现类厂对象 3.3.2 类厂对象的创建 3.3.3 实现自动注册 3.3.4 实现自动卸载 3.4 COM客户 3.4.1 COM对象创建函数 3.4.1.1 CoGetClassObject 3.4.1.2 CoCreateInstance 3.4.1.3 CoCreateInstanceEx 3.4.2 如何调用进程内组件 3.4.3 COM客户调用进程外组件 3.5 进一步认识COM 3.5.1 可重用机制:包容和聚合 3.5.2 进程透明性 3.5.3 安全性机制 小结 第4章 COM扩展技术 4.1 可连接对象机制 4.1.1 客户、接收器与可连接对象 4.1.1.1 接收器 4.1.1.2 可连接对象 4.1.1.3 客户 4.1.2 实现可连接对象 4.1.3 实现接收器 4.1.4 建立接收器与连接点的连接 4.1.5 获得出接口的类型信息 4.2 结构化存储 4.2.1 什么叫结构化存储和复合文件 4.2.2 存储对象和IStorage接口 4.2.2.1 IStorage接口 4.2.2.2 获得IStorage指针 4.2.2.3 释放STATSTG内存 4.2.2.4 枚举存储对象中的元

4,012

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧