How do I process the xamarin forms that connect to SQL Server and export data to the listView ? I'm looking for this simple example. What do I find on google ?

To connect to a SQL Server from a Xamarin app (using Visual Studio, so some instructions might change), I followed this process:

  1. Add in a System.Data reference to your project
  2. Add in a using directive "using System.Data.SqlClient"
  3. Define connection string and open the connection using SqlConnection(connectionString)
  4. Manipulate database as normal

My code connects to a SQL database located on a server (not localhost) and then searches for an account number to check if it exists. The code is:

string connectionString = @"Server=<ipAddress>;Database=<DBName>;User Id=<username>;Password=<password>;Trusted_Connection=true";
string databaseTable = "<yourDBTableName>";
string referenceAccountNumber = "0001134919";
string selectQuery = String.Format("SELECT * FROM {0} WHERE [Account_Number] = '{1}' ", databaseTable, referenceAccountNumber);

        using (SqlConnection connection = new SqlConnection(connectionString))
            //open connection

            SqlCommand command = new SqlCommand(selectQuery, connection);

            command.Connection = connection;
            command.CommandText = selectQuery;
            var result = command.ExecuteReader();
  //check if account exists
            var exists = result.HasRows;
    catch (Exception exception)
        #region connection error
        AlertDialog.Builder connectionException = new AlertDialog.Builder(this);
        connectionException.SetTitle("Connection Error");
        connectionException.SetNegativeButton("Return", delegate { });