I got another problem. If I try to select the Database from a MySQL Database I get a Error Message: The Value can not be NULL. Paramter: item (In German its: Der Wert darf nicht NULL sein. Parameter: item) So that means the Reader only select empty fields - he "selects NULL" - but the fields arent empty in my SQL-Database.
private: void Fillcombo(void) {
String^ constring = L"datasource=localhost;port=3306;username=root;password=ichstinkenachmaggie";
MySqlConnection^ conDataBase = gcnew MySqlConnection(constring);
MySqlCommand^ cmdDataBase = gcnew MySqlCommand("select rank from database.ranks;", conDataBase);
MySqlDataReader^ myReader;
try {
conDataBase->Open();
myReader = cmdDataBase->ExecuteReader();
while (myReader->Read()) {
String^ vRank;
myReader->GetString("rank");
rank_combo->Items->Add(vRank);
}
}
catch (Exception^ex) {
MessageBox::Show(ex->Message);
}
}
If replace the line:
rank_combo->Items->Add(vRank);
with this:
rank_combo->Items->Add(vRank + "*****");
then I dont get the error but in the combobox there are only 4 lines with 5 ***** :(
Hopefully you can help me somehow :)
Aucun commentaire:
Enregistrer un commentaire