当前位置:
代码迷
>>
其他数据库
>> 求高手帮忙解决方案
详细解决方案
求高手帮忙解决方案
热度:
5693
发布时间:
2013-02-26 00:00:00.0
求高手帮忙
opendatabase()怎么使用?求高手帮,最好带有实例
------解决方案--------------------------------------------------------
建议参考一下帮助手册吧。
引用
OpenDatabase Method
Opens a specified database in a Workspace object and returns a reference to the Database object that represents it.
Syntax
Set database = workspace.OpenDatabase (dbname, options, read-only, connect)
The OpenDatabase method syntax has these parts.
Part Description
database An object variable that represents the Database object that you want to open.
workspace Optional. An object variable that represents the existing Workspace object that will contain the database. If you don't include a value for workspace, OpenDatabase uses the default workspace.
dbname A String that is the name of an existing Microsoft Jet database file, or the data source name (DSN) of an ODBC data source. See the Name property for more information about setting this value.
options Optional. A Variant that sets various options for the database, as specified in Settings.
read-only Optional. A Variant (Boolean subtype) value that is True if you want to open the database with read-only access, or False (default) if you want to open the database with read/write access.
connect Optional. A Variant (String subtype) that specifies various connection information, including passwords.
Settings
For Microsoft Jet workspaces, you can use the following values for the options argument.
Setting Description
True Opens the database in exclusive mode.
False (Default) Opens the database in shared mode.
For ODBCDirect workspaces, the options argument determines if and when to prompt the user to establish the connection. You can use one of the following constants.
Constant Description
dbDriverNoPrompt The ODBC Driver Manager uses the connection string provided in dbname and connect. If you don't provide sufficient information, a run-time error occurs.
dbDriverPrompt The ODBC Driver Manager displays the ODBC Data Sources dialog box, which displays any relevant information supplied in dbname or connect. The connection string is made up of the DSN that the user selects via the dialog boxes, or, if the user doesn't specify a DSN, the default DSN is used.
dbDriverComplete (Default) If the connect and dbname arguments include all the necessary information to complete a connection, the ODBC Driver Manager uses the string in connect. Otherwise it behaves as it does when you specify dbDriverPrompt.
dbDriverCompleteRequired This option behaves like dbDriverComplete except the ODBC driver disables the prompts for any information not required to complete the connection.
Remarks
When you open a database, it is automatically added to the Databases collection. Further, in an ODBCDirect workspace, the Connection object corresponding to the new Database object is also created and appended to the Connections collection of the same Workspace object.
Some considerations apply when you use dbname:
If it refers to a database that is already open for exclusive access by another user, an error occurs.
If it doesn't refer to an existing database or valid ODBC data source name, an error occurs.
If it's a zero-length string ("") and connect is "ODBC;", a dialog box listing all registered ODBC data source names is displayed so the user can select a database.
If you're opening a database through an ODBCDirect workspace and you provide the DSN in connect, you can set dbname to a string of your choice that you can use to reference this database in subsequent code.
The connect argument is expressed in two parts: the database type, followed by a semicolon (;) and the optional arguments. You must first provide the database type, such as "ODBC;" or "FoxPro 2.5;". The optional arguments follow in no particular order, separated by semicolons. One of the parameters may be the password (if one is assigned). For example:
相关解决方案
xml/xslt 变量自增。解决方案
DB2 调用java自定义方法报错,请大牛帮忙~解决方案
关于request.getParameterValues()解决方案
一个JSP页面,在NETBEANS里报错!解决方案
WEB环境javamail取不到pop3邮件,解决方案
急来者有分,晚了就没了!解决方案
disable在IE8中可以接收焦点了?解决方案
求网页采集器的正则表达式。解决方案
关于FckEdit。解决方案
在Struts2 如果有多个拦截器栈顺序写错会有什么不同?解决方案
servlet+jquery1.4.2(ajax error?)解决方案
关于el 《c:if》。解决方案
jsp、taglib、velocity、freemarker等都过时了吗?解决方案
有开发过CA认证的朋友,帮个忙!解决方案
com.microsoft.sqlserver.jdbc.SQLServerException: 列名 n_id 无效。解决方案
java 缓冲区读写操作,求解?解决方案
EXTJS中treepanel树内部机制?解决方案
一个数学题,求个算法。解决方案
java 大文件上传?解决方案
从JSP中得到访问者的真实IP(很急)!解决方案
高分求解!解决方案
java可以跟PHP对接吗?解决方案
有什么办法在JSP页面在不使用<%%>情况下 使用数学函数Math.floor()解决方案
在JSP页面调用JavaBean,出错!初学!求指导!解决方案
简单的更改记录的语句?解决方案
JS方法内取的值是false,给方法传递的值却是正确的,请高手指教。解决方案
求教各位大神,初学JSP看什么书比较好呢?新一点的。解决方案
java调用so,解决方案
MyEclipse怎样运行applet程序?解决方案
JPA到底是神马?解决方案