请告诉我,为什么当我使用这部分代码时,我只能返回 Select 查询的结果,而不能返回 Select2 的结果?请
con.ConnectionString = mysqlSB.ConnectionString;
MySqlCommand Select = new MySqlCommand("select id from table1 where lang ='ua'", con);
MySqlCommand Select2 = new MySqlCommand("select id from table2 where car='bmw'", con);
MySqlDataReader myReader;
MySqlDataReader myReader2 ;
con.Open();
myReader = Select.ExecuteReader();
myReader2 = Select2.ExecuteReader();
return (myReader2["id"].ToString());
最佳答案
您可以使用两个“out”参数,将其传递给函数并用结果填充它。
public void MyFunction(out string res1, out string res2){
....
res1 = select.toString();
....
}
关于c# - 使用c#从mysql返回两个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22944887/