Formatting Databse Output C++

I've seen answers to this question a few times BUT the issue is they're all for console! I am making a visual C++ application and right now, i've overcame many hurdles in the pass day or so making this application butt his one i am just stuck on, how can i format output of a SQL database? i've figured out how i get the data into a list box but it is all crammed
My Code:
1
2
3
4
5
6
7
8
9
10
	MySqlConnection^ conDatabase = gcnew MySqlConnection(constring);
	MySqlCommand^ cmdDatabase = gcnew MySqlCommand("select * from logins.logins;", conDatabase);
	MySqlDataReader^ myReader;
	try {
		conDatabase->Open();
		myReader = cmdDatabase->ExecuteReader();
		while (myReader->Read()) {
			databox->Text += (myReader->GetString("user_name"));
		}
	}

what gets output into the list box named databox
JohnAlexElizabeth
what i want it to output or something like it, just something more organized
1
2
3

    Name                       Customer ID
   
    John                       1234
    Alex                       5678
    Elizabeth                  9012

Any links to a tutorial or any help is greatly appreciated!
Last edited on
closed account (48T7M4Gy)
Maybe parse the user_name string taking advantage of the second capital letter in the string. Other than, that who knows?

( PS Surely withdrawal has nothing to do with this. :)
How would i go about parsing?
closed account (48T7M4Gy)
How would i go about parsing?


Parsing means splitting the string into pieces in this case. You can use <string> functionality described in the reference section of this site - find, replace etc

"JohnAlexElizabeth" eg check each character and check if it is uppercase
http://www.cplusplus.com/reference/cctype/isupper/?kw=isupper thereby finding the locations within the string where uppercase occurs and where a 'cut' canbe made to produce a sub-string.



If databox is a ListBox you don't set the Text property but add the text to the items property.

databox->Items->Add("Your Text");

Why don't you treat yourself with a book about .NET.
https://www.amazon.com/Visual-NET-Platform-Experts-Voice/dp/1590596404/ref=sr_1_10?s=books&ie=UTF8&qid=1485251150&sr=1-10&keywords=stephen+Fraser

https://www.amazon.com/Visual-NET-Platform-Books-Professionals/dp/1430210532/ref=sr_1_4?s=books&ie=UTF8&qid=1485251150&sr=1-4&keywords=stephen+Fraser

They don't cover MySql but the database classes have the same properties and functions.

Just trial and error and copy & paste will lead only to frustration.
Last edited on
Topic archived. No new replies allowed.