[英]Getting back MySqlDataAdapter data via azure function HTTP trigger
This code work locally:此代码在本地工作:
string Link = $@"server= <some link that is working> ";
MySqlConnection connection = new MySqlConnection(Link);
connection.Open();
string command = $"<some command that is working>";
DataSet database = new DataSet();
MySqlDataAdapter data = new MySqlDataAdapter(command, connection);
data.Fill(database, "name");
Grid.DataSource = database;
Grid.DataMember = "name";
Any idea how can I convert it to Azure function, so that it will return the MySqlDataAdapter and I can read it to the grid?知道如何将其转换为 Azure function,以便它将返回 MySqlDataAdapter 并且我可以将其读取到网格中?
Hey, can you show how you do the http trigget for this one?嘿,你能展示一下你是如何为这个做 http 触发器的吗? I mean if I do:我的意思是,如果我这样做:
var responseString = await client.GetStringAsync("https://<function trigger address>")
how do I connect it to the grid?如何将其连接到电网?
One of the workaround is to return the SQL Data Adapter is:解决方法之一是返回 SQL 数据适配器是:
And the proper way for GridView
data binding should be like this:而GridView
数据绑定的正确方式应该是这样的:
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet output = new DataSet();
adapter.Fill(Output, "out");
GridViewOutput.DataSource = Output; // bind directly to DataSet
GridViewOutput.DataBind(); // bind to grid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.