出于某种原因,我在谷歌中找不到一个很好的答案,为什么这段代码有效:
MySqlConnection connection = new MySqlConnection("Databaseyeshuv1");
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText =
"SELECT * FROM `MASADE_FEA_bak2` WHERE `marom_num` equals `3`";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string line = Reader.GetString(1);
this.שטח_קומה_מחושב.Text = line;
}
connection.Close();
这是我得到的错误:
System.ArgumentException:初始化字符串的格式不符合从索引 0 开始的规范。在 System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) 在 System .Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) 在 System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) 在 System.Data。 Common.DbConnectionStringBuilder.set_ConnectionString(String value) 在 MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value) 在 MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString) 在 MyApp7.UI.Controls。ShowMASADE_FEA_bak2.KomotMASADE_FEA_bak2TableControlRow.Setשטח_קומה_מחושב()