请问谁可以向我解释这个ado数据库开放代码行? [英] Please who can explain this ado database open code line to me?

查看:44
本文介绍了请问谁可以向我解释这个ado数据库开放代码行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请尝试,了解如何在我的应用程序中使用数据库。我用谷歌搜索的这段特殊代码并不清楚。任何人都可以向我解释一下吗?

完整代码位于:http://www.kbcafe.com/articles/HowTo.ADO.CPlusPlus.pdf

什么每个参数/参数是什么意思?为什么?





connection-> open(LProvider = sqloledb; Data Source = fifa; L初始目录=测试;用户ID = testsa;密码= testsa,L,L,ADODB :: adConnectUnspecified);

Please,I am trying to,learn how to use databases in my application. This particular line of a code I googled out is not clear to me. Can any one explain it to me?
The full code is at: http://www.kbcafe.com/articles/HowTo.ADO.CPlusPlus.pdf
What does each parameter/argument mean and why?


connection->open(L"Provider=sqloledb; Data Source=fifa;L"Initial Catalog=test; User Id=testsa; Password=testsa",L"",L"",ADODB::adConnectUnspecified);

推荐答案

参见< a href =http://msdn.microsoft.com/en-us/library/windows/desktop/ms675810(v=vs.85).aspx> ConnectionString属性(ADO) [ ^ ] ,连接字符串语法 [ ^ ]和打开方法(ADO连接) [ ^ ]。使用文档来帮助您构建ConnectionString然后,如果它不起作用,请询问一个特定的问题。



连接对象的解释打开示例中的方法参数

语法:

ConnectionString

可选。包含连接信息的String值。有关有效设置的详细信息,请参阅ConnectionString属性。



UserID

可选。一个String值,包含建立连接时使用的用户名。



密码

可选。一个String值,包含建立连接时使用的密码。



选项

可选。一个ConnectOptionEnum值,用于确定此方法是否应在建立连接之后(同步)或之前(异步)返回。



每个参数的详细信息

第一个参数(ConnectionString)

* Provider - 程序和数据库引擎之间的接口。有几种选择。 SQLOLEDB是Microsoft SQL Server的ADO.NET提供程序。

*数据源 - 数据库服务器名称或IP地址

*初始目录 - 数据库的名称数据库服务器

*用户ID - 配置到数据库服务器的用户名

*密码 - 配置到数据库服务器的密码



第二个参数(用户ID)

第一个空字符串 - 用户ID作为参数传递而不是在ConnectionString中传递



第三个参数(密码)

第二个空字符串 - 密码作为参数传递而不是在ConnectionString中传递



第四个参数(选项)

ADODB :: adConnectUnspecified - 指定连接应该是同步连接。请参阅 ConnectOptionEnum [ ^ ]



注意

如果您使用集成安全性,您不需要在ConnectionString或Open语句中使用用户ID 密码
See ConnectionString Property (ADO)[^], Connection String Syntax[^] and Open Method (ADO Connection)[^]. Use the documentation to help you construct your ConnectionString and then, if it does not work, ask a specific question.

Explanation of Connection object Open Method parameters in your example
Syntax:
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.

Details of each parameter
First Parameter (ConnectionString)
* Provider - The interface between your program and the database engine. There are several options. SQLOLEDB is the ADO.NET provider for Microsoft SQL Server.
* Data Source - The database server name or IP Address
* Initial Catalog - The name of the database on the database server
* User Id - A username configured into the database server
* Password - A password configured into the database server

Second Parameter (User Id)
First empty string - User Id passed as parameter instead of in ConnectionString

Third Parameter (Password)
Second empty string - Password passed as parameter instead of in ConnectionString

Fourth Parameter (Options)
ADODB::adConnectUnspecified - Specifies that the connection should be a synchronous connection. See ConnectOptionEnum[^]

Note
If you use Integrated Security, you do not need to use User Id and Password in the ConnectionString or in the Open statement.


我不能告诉你他们所有的意思,但我可以告诉你他们中的大部分:



Provider =连接类型,无论是SQL,SQLite,MYSQL等。

初始目录=数据库名称,

用户ID =用户名

密码=密码



我永远不会记得数据源是什么,但它可能指的是服务器。
I can''t tell you what all of them mean, however I can inform you of a most of them:

Provider = the type of connection, be it SQL, SQLite, MYSQL, etc.
Initial Catalog = name of the database,
User ID = username
password = password

I can never quite remember what the Data Source is, but it may refer to the server.

这篇关于请问谁可以向我解释这个ado数据库开放代码行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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