简体   繁体   中英

In Blazor Web Assembly ASP.net core hosted

Thhis is my method in the server, I want to pass the filled Data.table DtDictionary to the client, how?

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

Well your question is not clear, But i can imagine you have server application that filled this DataTable and you want a client application to be able to get this DataTable. Well since they are both different Apps you can pass the data between them using JSON, your server should provide an end-point that can be called from the client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM