0

Ok... im rewriting the sql query and the tabel tomorrow ... im sleepy.
Thank you for your help :)

EDit: Actually, i stopped the sql server. I executed my code and strError should be something like ... "Coult not connect etc" but ... is blank .. no content :)

Here

bool GetListFromDb(List<String^>^ lst_strNames, String^% strError)
{
   bool blnRetVal = true;
 
   try
   {
      MySqlConnectionStringBuilder^ csb = gcnew MySqlConnectionStringBuilder();
      csb->Server = "localhost";
      csb->Database = "dumi";
      csb->UserID = "dumi";
      csb->Password = "dumi";
 
      MySqlConnection^ conn = gcnew MySqlConnection(csb->ToString());
      String^ strSQL = "SELECT * FROM `bla` WHERE (`ident` = '1' );";
      MySqlDataReader^ rdr = (gcnew MySqlCommand(strSQL, conn))->ExecuteReader();
      while(rdr->Read())
      {
         lst_strNames->Add(rdr["blah2"]->ToString()->Trim());
      }
      rdr->Close();
      conn->Close();
   }
   catch(Exception^ exc)
   {
      blnRetVal = false;
   }
 
   return blnRetVal;
}

I dont see that strError is used .. Possibly you forgotted to write the output of the error ?

Edited by zekstein: n/a

0

...which should mean something is NOW in the List, right?

Yes, something like 'game.domain.tld'( that is in the sql table ) should be :)

Edited by zekstein: n/a

0

???
You gaved me :

String^ strError = "";
    List<String^>^ lst_strNames = gcnew List<String^>();
 
    if(!GetListFromDb(lst_strNames, strError))
    {
      this->textBox1->Text = [B]String::Join("\n", Enumerable::ToArray<String^>(lst_strNames));[/B]
	  this->textBox3->Text = strError;
      // return -1;
    }
	else
	{
		this->textBox1->Text = strError;
	}

Edited by zekstein: n/a

0

NO (wrong order).
The stuff inside the first set of braces is for failure.
The stuff after that is for success.

That conversion should be after you have determined success.

The exclamation point ! means NOT
If it cannot get the data, it should show a failure message and return.

AFTER THAT (success), it should process the data that was retrieved from the database.

Edited by thines01: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.