在Samsung Gear S3智能手表上从C执行Azure SQL查询

时间:2017-01-06 18:52:28

标签: c sql-server azure tizen samsung-gear

如何在Gear S3应用程序中从内部执行MSSQL查询?我目前正在运行C#代码来从桌面应用程序执行查询,如下所示:

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);
}

我可以使用Tizen将这种类型的功能添加到用C编写的智能手表应用程序中吗?

0 个答案:

没有答案