<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css">
<title>
Gambas Documentation - DB.Open
 (gb.db)</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../../help+en"><img class="flag" alt="Home" border="0" src="../../../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../db+en">Up</a>&nbsp;
<a href="long+en">Previous</a>&nbsp;
<a href="opened+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
DB.Open
 (gb.db)</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><font color="blue">STATIC</font> <font color="blue">SUB</font> <b>Open</b> <font color="blue">(</font> <font color="blue">)</font></pre>
Opens the connection to the database.
<p>
The connection properties should be set prior to this.
<p>
<div class="gray"><font size="-2"><b>Example</b></font></div>
<pre class="example">DIM $hConn As NEW Connection

WITH $hConn
   .Type = &quot;postgresql&quot;
   .Host = &quot;localhost&quot;
   .Login = &quot;username&quot;
   .Password = &quot;passwd&quot;
   .Name = &quot;testdb&quot;
END WITH

TRY $hConn.Open
IF Error THEN PRINT &quot;Cannot Open Database. Error = &quot;; Error.Text</pre>

</div>
</body>
</html>

