📄 openingdatabases.htm
字号:
<html>
<head>
<title>Connecting to Databases</title>
</head>
<!--#include virtual="/inc/header.php"-->
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF">
<tr>
<td align="left">
<span style="font-family:Helvetica,Arial; font-size:12pt; color:#000000"><b>Connecting to Databases
<br>
</b></span>
</td>
<td align="right">
<font face="Arial" size="2">
<a href="creatingtables.htm">Previous</a>
<a href="overview.htm">Top</a>
<a href="openingtables.htm">Next</a>
</font>
</td>
</tr>
</table>
<br><br>
<span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"><b>Connecting to a database</b></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">
<br>
<br>
You can connect to a database file by the following steps:
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="15"></td><td width="25"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"></span></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">1.</span></span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">Set the TABSDatabase.</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"><a href=tabsdatabase_multiuser.htm>MultiUser</a></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"> property to True, if multi-user database access is expected or set the MultiUser property to False, if database access is known to be a single-user one.
<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="15"></td><td width="25"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">2.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">Call the TABSDatabase.</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"><a href=tabsdatabase_open.htm>Open</a></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"> method or set the TABSDatabase.</span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"><a href=tabsdatabase_connected.htm>Connected</a></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"> property to True.
<br>
</span></span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="15"></td><td width="25"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"></span></td><td></td></tr></table><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">
<br>
Setting Connected to True executes the Open method. Open verifies that the database specified by the TABSDatabase.DatabaseFileName exists and opens the database file.
<br>
<br>
<br>
</span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"><b>Disconnecting from a database</b></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">
<br>
<br>
There are two ways to disconnect open database from a database component:
<br>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="15"></td><td width="25"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"></span></span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">1.</span></span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">Set the TABSDatabase.Connected property to False.
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="15"></td><td width="25"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">2.</span></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">Call the TABSDatabase.Close method.
<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="15"></td><td width="25"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"></span></td><td></td></tr></table><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100"></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><span style="font-family:Helvetica,Arial; font-size:10pt; color:#010100">
<br>
Setting Connected to False calls Close. Close closes all open datasets and database file. For example, the following code closes all active datasets and database file for a database component :
<br>
ABSDatabase1.Connected := False;
<br>
</span></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span></span>
<!--#include virtual="/inc/footer.php"-->
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -