我想将 sql 查询结果传递给 C# 中的变量。例如。我有表名 TEST_TABLE,我想将它的值传递给一个名为“Customer_details_values”的 c# 变量。我正在这样做
String Customer_details_values;
StringBuilder var1 = new StringBuilder();
String var1 = "";
var1 = var1 +"SELECT name, "+"\n";
var1 = var1 +" account_type, "+"\n";
var1 = var1 +" city, "+"\n";
var1 = var1 +" phone, "+"\n";
var1 = var1 +" account_details, "+"\n";
var1 = var1 +" gender "+"\n";
var1 = var1 +"FROM test_table ";
Customer_details_values= var1.ToString()
它没有给我任何错误,但即使它没有将任何值传递给变量。