簡體   English   中英

In Blazor Web Assembly ASP.net core hosted

[英]In Blazor Web Assembly ASP.net core hosted

這是我在服務端的方法,我想把填好的Data.table DtDictionary傳給客戶端,怎么辦?

public class ClssDictionary
{
    public static DataTable DtDictionary = new();
    public static async Task M2dDictionary()
    {            try
        {
            SqlConnection sqlconNew = new(StrSqlconnection);
            await sqlconNew.OpenAsync();
            string strSqlcmdQry = "select * from dictionary";
            SqlCommand sqlcmdQry = new(strSqlcmdQry, sqlconNew);
            SqlDataAdapter sqldaNew = new(sqlcmdQry);
            sqldaNew.Fill(DtDictionary);
        }
        catch (SystemException se) { Console.WriteLine( se.Message); }
    }
    
}

嗯,你的問題不清楚,但我可以想象你有填充這個數據表的服務器應用程序,你希望客戶端應用程序能夠獲取這個數據表。 好吧,因為它們都是不同的應用程序,您可以使用 JSON 在它們之間傳遞數據,您的服務器應該提供一個可以從客戶端調用的端點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM