---
url: /flow/developer-guide/developing-with-flowapi/functions/general/flo_login.md
---

# Flo_Login

## Declaration

C# public static extern bool Flo_Login(string Hostname, string Database, string Username, string Password);

**Delphi** function Flo_Login(Hostname, Database, Username, Password : PChar) : boolean; stdcall;

### Example

```csharp
C#- Connect to SQL Compact
try
{
Boolean result = FlowAPI.Flo_Login("computername\\sqlinstancename", "databasename", "username", "password");
if (result) MessageBox.Show("Successfully logged in"); else MessageBox.Show("Error logging in");
}
catch (Exception ex)
{
MessageBox.Show("Exception logging in to Flow configuration - " + ex.Message);
}

C#- Connect to SQL Server
try
{
Boolean result = FlowAPI.Flo_Login("", "C:\CONFIG\Flow.sdf", "", "password");
if (result) MessageBox.Show("Successfully logged in"); else MessageBox.Show("Error logging in");
}
catch (Exception ex)
{
MessageBox.Show("Exception logging in to Flow configuration - " + ex.Message);
}
```

```pascal
Delphi - Connect to SQL Compact
try
Result := Flo_Login('','C:\CONFIG\Flow.sdf','','password');
if Result then
showmessage('Successfully logged in')
else
showmessage('Error logging in');
except
on e : exception do
showmessage('Exception logging in to Flow configuration - ' e.Message);
end;

Delphi - Connect to SQL Server
try
Result := Flo_Login('computername\sqlinstancename','databasename','username','password'); //leave username/password blank to use Windows Authentication
if Result then
showmessage('Successfully logged in')
else
showmessage('Error logging in');
except
on e : exception do
showmessage('Exception logging in to Flow configuration - ' e.Message);
end;
```

## Description

Logs the FlowAPI into the configuration database. You must call [Flo_Logout](/flow/developer-guide/developing-with-flowapi/functions/general/flo_logout) when you are finished. If you are logged in and need to switch to another configuration database you will need to logout first.

Hostname - enter the host name of your SQL server in the form \<computername>\\\<sqlinstancename>

Database - name of the database on that SQL server. If connecting to SQL Server compact provide the full path to the SDF file.

Username - SQL server user name to connect to configuration database. Leave blank when connecting to SQL Server Compact.

Password - for above SQL server username

::: tip
You can connect to SQL Server using Windows Authentication by leaving the username and password blank
:::

::: tip
You can connect to SQL Server compact databases by leaving Hostname and Username blank. Provide the path to the SDF file in the Database parameter. Provide a password if the database is password protected.
:::
