Visual C++ using parameters with MySqlDataAdapter -
i trying make simple login screen without encryption part (i have make research on later). college project , still starting learn. , having troubles code or whatever think exception catching error , printing me.
here's code:
string^ user = usertxt->text; string^ pass = pwtxt->text; try{ cn->connectionstring = cninfo; cn->open(); string^ loginquery = "select * acceso user_id = @auser , user_pass = @apass;"; logincmd = gcnew mysqlcommand(loginquery, cn); cmdadp->selectcommand = logincmd; logincmd->commandtype = commandtype::text; logincmd->parameters->addwithvalue("@auser", user); logincmd->parameters->addwithvalue("@apass", pass); cmdadp->fill(table); if (table->rows->count > 0) { messagebox::show("login success"); //in here launch other form application::run(gcnew turismo::myform); exitbtn_click(sender, e); table->rows->clear(); } else{ messagebox::show("login error: incorrect login info"); table->rows->clear(); } } catch (exception^ ex){ messagebox::show(ex->message); } finally{ cn->close(); }
sorry lack of documentation. in bit of hurry finish it.
logincmd = gcnew mysqlcommand(loginquery, cn); cmdadp->selectcommand = logincmd; logincmd->commandtype = commandtype::text; logincmd->parameters->addwithvalue("@auser", user); logincmd->parameters->addwithvalue("@apass", pass);
this part got researching on "how use parameters command adapter". , @ end of program when click on login, on exception message:
reference object not stablished intance of object.
Comments
Post a Comment