我需要在我的 MySQL 结果中将“,”替换为“.”
string.Replace(",", ".");
当前代码:
mysql.Connection.Open();
mysql.Command.CommandText = query;
mysql.Reader = mysql.Command.ExecuteReader();
string new_ = String.Empty;
while (mysql.Reader.Read())
{
/*
foreach(var field in mysql.Reader)
{
// what i do here?
}
*/
// here i have code to add to TextBox value
}
我不知道如何替换...我尝试了一些类似的 字段 = 替换字符串 但 Visual Studio 无法接受此代码。
最佳答案
尝试
result = mystring.Replace(',', '.');
其中 mystring 是您要编辑的任何字符串
关于C# MySQLDataReader 在结果中替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11417908/