SQL | C# - 读者行
我的MySqDataReader有一个小问题。我在MySQL中有数据,并且在下面有“名称”和x行。读者可以吸引所有这些内容,但输出中有一个字符串,看起来像“ firtsecondixd”,但我需要单词列表中的所有这些单词。代码是:
while (reader.Read())
{
vystup.Add(reader[0].ToString());
}
connection.Close();
string out1 = "";
foreach (string outage in vystup)
{
out1 += outage + "\n";
}
return out1;
有人知道该怎么办吗?谢谢。
I have a small problem with MySqlDataReader. I have data in MySql and I have column "name" and X rows under. Reader reads sucessfully all of this but output is in one string and looks like "FirtSecondThird" but i need all of this words in list word by word. The code is:
while (reader.Read())
{
vystup.Add(reader[0].ToString());
}
connection.Close();
string out1 = "";
foreach (string outage in vystup)
{
out1 += outage + "\n";
}
return out1;
Does anyone know what to do with it? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
如果
vystup
是list< string>
,其中包含以下项目,“第一个”,“第二”,“第三”
然后
输出
string.join(enviorment.newline,vystup)
将产生
“第一个”
“第二”
“第三”
You can use String.Join
if
vystup
is aList<string>
which contains the following items"first", "second","third"
then
outputting
string.join(Enviorment.NewLine, vystup)
will yield
"first"
"second"
"third"