Execute Azure SQL Query from C on Samsung Gear S3 Smart Watch

92 Views Asked by At

How can I execute an MSSQL query from within in a Gear S3 application? I currently have C# code running to execute the query from a desktop app which looks like this:

string connection = ConfigurationManager.ConnectionStrings["ABC_Data_Center.Properties.Settings.ABCDataCenterConnectionString"].ConnectionString;
try
{
    using (SqlConnection newSQLconnection = new SqlConnection(connection))
    {
        newSQLconnection.Open();
        SqlCommand command = new SqlCommand();
        command.CommandText = "select sum(weight) as int from harvest join field on (field.field_id = harvest.field_id) join location on (field.location_id = location.location_id) where cast(timestamp as date) = cast(@current_Time as date) and (location.account_id = @account_id)";
        command.Parameters.AddWithValue("@account_id", account_id);
        command.Parameters.AddWithValue("@current_Time", DateTime.Now);
        todaysHarvest.Text = Convert.ToInt32(command.ExecuteScalar()).ToString("N0");
    }
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}

Can I add this type of functionality to a smart watch application written in C using Tizen?

0

There are 0 best solutions below