ADO调用,高分赠送,急,在线等

Paris_Luo 2002-12-06 08:05:41
_ConnectionPtr m_pCon;
if(FAILED(hr=m_pCon->Open(_bstrDataSource,
_bstr_t(L""),
_bstr_t(L""),
adModeUnknown)))
return hr;
谁能解释一下,open函数中4个参数的含义?为什么msdn中差不到ado调用方法?
我想调一个interbase的数据库,有用户和密码,应该在什么地方更改,是否有特别的地方?
...全文
123 7 打赏 收藏 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
fingerfox 2002-12-07
  • 打赏
  • 举报
回复
Open Method (ADO Connection)
Opens a connection to a data source.

Syntax
connection.Open ConnectionString, UserID, Password, Options
Parameters
ConnectionString
Optional. A String value that contains connection information. See the ConnectionString property for details on valid settings.
UserID
Optional. A String value that contains a user name to use when establishing the connection.
Password
Optional. A String value that contains a password to use when establishing the connection.
Options
Optional. A ConnectOptionEnum value that determines whether this method should return after (synchronously) or before (asynchronously) the connection is established.
Remarks
Using the Open method on a Connection object establishes the physical connection to a data source. After this method successfully completes, the connection is live and you can issue commands against it and process the results.

Use the optional ConnectionString argument to specify either a connection string containing a series of argument = value statements separated by semicolons, or a file or directory resource identified with a URL. The ConnectionString property automatically inherits the value used for the ConnectionString argument. Therefore, you can either set the ConnectionString property of the Connection object before opening it, or use the ConnectionString argument to set or override the current connection parameters during the Open method call.

If you pass user and password information both in the ConnectionString argument and in the optional UserID and Password arguments, the UserID and Password arguments will override the values specified in ConnectionString.

When you have concluded your operations over an open Connection, use the Close method to free any associated system resources. Closing an object does not remove it from memory; you can change its property settings and use the Open method to open it again later. To completely eliminate an object from memory, set the object variable to Nothing.

Remote Data Service Usage When used on a client-side Connection object, the Open method doesn't actually establish a connection to the server until a Recordset is opened on the Connection object.
Note URLs using the http scheme will automatically invoke the Microsoft OLE DB Provider for Internet Publishing. For more information, see Absolute and Relative URLs.
See Also
Visual Basic Example | VBScript Example | Visual C++ Example | Visual J++ Example

Open Method (ADO Record) | Open Method (ADO Recordset) | Open Method (ADO Stream) | OpenSchema Method

Applies To: Connection Object
xsc2001 2002-12-07
  • 打赏
  • 举报
回复
_ConnectionPtr pConn;
if (FAILED(pConn.CreateInstance("ADODB.Connection")))
{
AfxMessageBox("Create Instance failed!");
return;
}

CString strSRC;

strSRC="DRIVER=Microsoft Visual FoxPro Driver;";//这里可写你所选择的数据库驱动类型
strSRC+="SourceType=DBF;";
strSRC+="SourceDB=";
strSRC+=strFoldName;//在这里写你的数据库表存放的路径
strSRC+=";UID=SA;PWD=";
_variant_t varSRC(strSRC);


_bstr_t bstrSRC(strSRC);

if (FAILED(pConn->Open(bstrSRC,"","",-1)))
{
AfxMessageBox("Can not open Database!");
pConn.Release();
return;
}
xsc2001 2002-12-07
  • 打赏
  • 举报
回复
_ConnectionPtr pConn;
if (FAILED(pConn.CreateInstance("ADODB.Connection")))
{
AfxMessageBox("Create Instance failed!");
return;
}

_bstr_t bstrSRC(strSRC);

if (FAILED(pConn->Open(bstrSRC,"","",-1)))
{
AfxMessageBox("Can not open Database!");
pConn.Release();
return;
}
xlwz 2002-12-07
  • 打赏
  • 举报
回复
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=网络路径","你的id","你的密码",adModeUnknown);

xlwz 2002-12-07
  • 打赏
  • 举报
回复
http://www.pconline.com.cn/pcedu/empolder/gj/vc/10111/15805_1.html
讲的很详细!去看看吧!
DaQiangZi 2002-12-06
  • 打赏
  • 举报
回复
第一个:数据源名称或联接字符串
第二个:用户名
第三个:密码
第四个:打开方式(同步/异步)

z_q@zuo.com.cn, 来信送你一本ado的书,大部分例子都是vb的,部分是c++的,对于学习足够了。
RomanticProgrammer 2002-12-06
  • 打赏
  • 举报
回复
up
内容概要:本文针对孤岛微电网在运行中面临的功率分配不均、电压频率波动等问题,提出了一种基于多智能体一致性演化的自适应虚拟阻抗容错控制与二次稳态补偿机制,并通过Simulink平台进行仿真实现。研究采用多智能体系统(MAS)框架,将各分布式电源建模为具备局部信息交互能力的智能体,利用一致性算法实现全局协同控制;结合自适应虚拟阻抗技术动态调节等效输出阻抗,有效克服线路阻抗差异导致的有功与无功功率耦合问题,提升功率均分精度;同时设计二次控制补偿环节,消除一次下垂控制引入的静态偏差,恢复电压和频率至额定水平。该机制具备良好的容错能力,在部分节点发生故障或通信中断时可自动重构控制结构,维持系统稳定运行,适用于高可靠性和自治性要求的孤岛微电网场景。; 适合人群:具备电力系统、自动化或电气工程等相关专业背景,熟悉微电网控制、多智能体系统理论及现代控制方法的研究生、科研人员及工程技术人员。; 使用场景及目标:①为孤岛微电网提供高精度、强鲁棒性的分布式协同控制解决方案;②解决传统下垂控制中存在的功率分配不准与电能质量下降问题;③实现系统在故障扰动下的自主容错与快速恢复,提升微电网的自愈能力与运行可靠性。; 阅读建议:建议读者结合Simulink仿真模型深入理解控制策略的实现细节,重点关注多智能体通信拓扑构建、一致性协议设计、虚拟阻抗自适应律以及二次补偿控制器的参数整定方法,同时可通过修改故障场景和通信条件进行对比实验,全面掌握该机制的动态响应特性与适应范围。
内容概要:本文围绕“2026年华为杯E题”展开,聚焦于复杂场景下的多模态情感识别问题,提供一套完整的数学建模与算法设计解决方案,涵盖解题思路、代码实现与论文撰写指导,并持续更新优化。该资源隶属于“荔枝科研社”这一综合性科研服务平台,内容涉及智能优化算法、机器学习与深度学习、图像处理、路径规划、通信技术、信号处理、电力系统管理等多个前沿技术领域,主要采用MATLAB和Python作为开发工具,强调对实际科研与竞赛问题的建模仿真与算法优化,具有较强的实践性和应用价值。; 适合人群:具备一定编程基础和科研能力,从事或有意参与数学建模、人工智能、自动化、电气工程等相关领域的研究生、高校学生及科研工作者,尤其适合备战“华为杯”等高水平学科竞赛的参赛者。; 使用场景及目标:①为“2026年华为杯E题”参赛者提供系统性的解题思路、高质量代码参考与论文写作模板;②支持科研人员在多模态情感识别、深度学习建模、智能优化等领域开展算法验证与系统仿真研究;③辅助高校教师教学与学生自主学习,提升复杂工程问题的建模能力与编程实践水平。; 阅读建议:建议读者结合提供的网盘资源与在线目录进行系统性学习,优先选择与自身研究方向契合的技术模块,动手运行并调试代码,尝试复现论文成果,同时关注微信公众号“荔枝科研社”以获取最新资料更新与技术动态。

4,017

社区成员

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

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