Difference between revisions of "Database.Host"

From Xojo Documentation

(Sample Code)
 
Line 22: Line 22:
 
   db.Connect
 
   db.Connect
 
   // Use the database
 
   // Use the database
Catch error as DatabaseException
+
Catch error As DatabaseException
 
   // DB Connection error
 
   // DB Connection error
 
   MessageBox(error.Message)
 
   MessageBox(error.Message)
 
End Try

 
End Try

 
</rbcode>
 
</rbcode>

Latest revision as of 17:38, 12 November 2019

Property (As String )
aDatabase.Host = newStringValue
or
StringValue = aDatabase.Host

Supported for all project types and targets.

The database host name or IP address of the database server.

Sample Code

This examples connects to a PostgreSQL database called "BaseballLeague":

Var db As New PostgreSQLDatabase
db.Host = "192.168.1.172"
db.Port = 5432
db.DatabaseName = "BaseballLeague"
db.UserName = "broberts"
db.Password = "streborb"
Try
db.Connect
// Use the database
Catch error As DatabaseException
// DB Connection error
MessageBox(error.Message)
End Try