【发布时间】:2018-12-07 12:35:47
【问题描述】:
目前我只能使用以下触发器上传一个 blobtype(text)
#r "System.Configuration"
#r "System.Data"
using System.Configuration;
using System.Data.SqlClient;
using System.Threading.Tasks;
using System;
public static void Run(Stream myBlob, string name, TraceWriter log)
{
log.Info($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
string detail = ($"{name}");
var str = ConfigurationManager.ConnectionStrings["sqldb_connection"].ConnectionString;
using (SqlConnection conn = new SqlConnection(str))
{
conn.Open();
var text = "INSERT INTO PhotoTable(CreatedAt,UpdatedAt,IsDeleted, Url, Title) " +
"VALUES (SYSDATETIMEOFFSET(),SYSDATETIMEOFFSET(), 'true', 'yrhrh', @Name)";
using (SqlCommand cmd = new SqlCommand(text, conn))
{
cmd.Parameters.AddWithValue("@Name", name);
// Execute the command and log the # rows affected.
var rows = cmd.ExecuteNonQueryAsync();
log.Info($"{rows} rows were updated");
}
}
}
有 2 个问题 01)他们有什么方法可以同时上传两种类型的Azure SQLstorage吗?(例如文本blob和图像blob)
02) 使用此触发器,我只获取 blob 存储的 ID 而不是内容,这也是一个问题,我也可以通过任何方式获取 blob 存储的内容?? ,
非常感谢您的帮助,谢谢
【问题讨论】:
-
提供的答案对您的方案有帮助吗?
标签: azure xamarin.forms azure-sql-database azure-blob-storage