1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
private: System::Void registration_button_Click(System::Object^ sender, System::EventArgs^ e)
{String^ constring=L"datasource=applicationdata.db.104xxxxx.hostedresou rce.com;port=3306;
username=applicationdata;password=xxxxxx";
MySqlConnection^ conDataBase=gcnew MySqlConnection(constring);
MySqlCommand^ cmdDataBase=gcnew
MySqlCommand("insert into applicationdatas.app_users (fname, email,
password, address, country, state, city, postal_code, phone) VALUES
('"+this->ufullname_txt->Text+"', '"+this->uemail_txt->Text+"',
'"+this->upassword_txt->Text+"', '"+this->uaddress_txt->Text+"',
'"+this->country_comboBox->Text+"', '"+this->state_comboBox->Text+"',
'"+this->city_comboBox->Text+"', '"+this->zipcode_txt->Text+"',
'"+this->phone_txt->Text+"') ;",conDataBase);
//MySqlDataReader^ myReader;
try{
conDataBase->Open();
//myReader=cmdDataBase->ExecuteReader();
int rowsAffected = cmdDataBase->ExecuteNonQuery();
if(rowsAffected >0)
{
MessageBox::Show("Registration Successful!");
login^ f5 =gcnew login();
f5->ShowDialog();
}
else
{
MessageBox::Show("Registration Failed!");
Application::Exit();
}
conDataBase->Close();
}catch(Exception^ex){
MessageBox::Show(ex->Message);
}
}
|