EDN Admin
Well-known member
hello folks,
I have developed a program that reads values from serial port and stores it in the MYSQL database. I want to retrieve all the values from the database to a textbox present in windows form application on click of button..
can any1 Help..?
thanks in advance.
this is the code : but it only gives me the 1st value from the SQL DB
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) <br/>
<span style="white-spacere {<br/>
<span style="white-spacere int query_state;<br/>
<span style="white-spacere mysql_init(&mysql);<br/>
<span style="white-spacere connection = mysql_real_connect(&mysql,"localhost","root","root","weight",0,0,0);<br/>
<span style="white-spacere if(connection == NULL)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere textBox3->Text="SQL Not Connected";<br/>
<span style="white-spacere }<br/>
<span style="white-spacere else <br/>
<span style="white-spacere {<br/>
<span style="white-spacere std::string DOIT= "select * from weht";<br/>
<span style="white-spacere query_state = mysql_query(connection,DOIT.c_str());<br/>
<span style="white-spacere if (query_state != 0)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere <br/>
<span style="white-spacere textBox3->Text="query error";<span style="white-spacere
<br/>
<span style="white-spacere }<br/>
<span style="white-spacere else<br/>
<span style="white-spacere {<br/>
<span style="white-spacere result = mysql_store_result(connection);<br/>
<span style="white-spacere <span style="white-spacere <br/>
<span style="white-spacere row = mysql_fetch_row(result);<br/>
<span style="white-spacere std:stringstream o;<br/>
<span style="white-spacere o << row[0];<br/>
<span style="white-spacere std::string s(o.str());<span style="white-spacere
<br/>
<span style="white-spacere textBox3->Text= gcnew System::String(s.c_str());<span style="white-spacere
<br/>
<span style="white-spacere }<br/>
<span style="white-spacere <br/>
<span style="white-spacere <br/>
<span style="white-spacere }<br/>
<span style="white-spacere <br/>
<span style="white-spacere <br/>
<span style="white-spacere }
View the full article
I have developed a program that reads values from serial port and stores it in the MYSQL database. I want to retrieve all the values from the database to a textbox present in windows form application on click of button..
can any1 Help..?
thanks in advance.
this is the code : but it only gives me the 1st value from the SQL DB
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) <br/>
<span style="white-spacere {<br/>
<span style="white-spacere int query_state;<br/>
<span style="white-spacere mysql_init(&mysql);<br/>
<span style="white-spacere connection = mysql_real_connect(&mysql,"localhost","root","root","weight",0,0,0);<br/>
<span style="white-spacere if(connection == NULL)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere textBox3->Text="SQL Not Connected";<br/>
<span style="white-spacere }<br/>
<span style="white-spacere else <br/>
<span style="white-spacere {<br/>
<span style="white-spacere std::string DOIT= "select * from weht";<br/>
<span style="white-spacere query_state = mysql_query(connection,DOIT.c_str());<br/>
<span style="white-spacere if (query_state != 0)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere <br/>
<span style="white-spacere textBox3->Text="query error";<span style="white-spacere
<br/>
<span style="white-spacere }<br/>
<span style="white-spacere else<br/>
<span style="white-spacere {<br/>
<span style="white-spacere result = mysql_store_result(connection);<br/>
<span style="white-spacere <span style="white-spacere <br/>
<span style="white-spacere row = mysql_fetch_row(result);<br/>
<span style="white-spacere std:stringstream o;<br/>
<span style="white-spacere o << row[0];<br/>
<span style="white-spacere std::string s(o.str());<span style="white-spacere
<br/>
<span style="white-spacere textBox3->Text= gcnew System::String(s.c_str());<span style="white-spacere
<br/>
<span style="white-spacere }<br/>
<span style="white-spacere <br/>
<span style="white-spacere <br/>
<span style="white-spacere }<br/>
<span style="white-spacere <br/>
<span style="white-spacere <br/>
<span style="white-spacere }
View the full article