退货清单:
List<string> data = new List<string>();
using (SqlConnection connection = new SqlConnection(ConnectionString))
{
string strCommandtext = "SELECT CONCAT([name],'_',[Number]) FROM [newTable]";
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(strCommandtext, connection);
DataSet ds = new DataSet();
sqlDataAdapter.Fill(ds);
foreach (DataRow drRow in ds.Tables[0].Rows)
{
controllerData.Add(drRow[0].ToString());
}
}
string demo = JsonConvert.SerializeObject(controllerData);
return demo;
插入到文档 db / cosmos db
await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("databaseID", "collectionID"), demo);
但它会引发错误:
{“你调用的对象是空的。”}