您好我是C ++编程的新手, 我做了一个登录表格(ATM登录页面),如果用户输入一个正确的卡号和密码,它将把他带到另一个表格并关闭当前表格,无论如何 在第二种形式,我希望它显示该卡号的用户名和余额 任何帮助将不胜感激。
我在第二个表单代码中尝试做的事情:
private: System::Void MyForm1_Load(System::Object^ sender, System::EventArgs^ e) {
String^ constring = "datasource=localhost;port=3306;username=root;password=123123567;sslmode=none;";
MySqlConnection^ conDataBase = gcnew MySqlConnection(constring);
MySqlCommand^ cmdDataBase = gcnew MySqlCommand("select * from atm.atmusers;", conDataBase);
MySqlDataReader^ myReader;
try
{
conDataBase->Open();
myReader = cmdDataBase->ExecuteReader();
while (myReader->Read())
{
lblname->Text = (myReader->GetString("username"));
lblbal->Text = (myReader->GetString("balance"));
}
}
catch (Exception^ex)
{
MessageBox::Show(ex->Message);
}
}