Salut tout le monde,
j'ai un autre problème. Je ne parviens pas à passer des variables en paramètres à ma chaine sql dont voici le code :
J'ai l'erreur suivante :
Erreur 2 error C2440: '=' : impossible de convertir de 'std::basic_string<_Elem,_Traits,_Ax>' en 'System::String ^' e:\projet c++\identification.cpp 11
je n'y comprend rien !!!
Merci de m'aider
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
|
void identification::saisieindent()
{
string var, wlogin, wpass;
cout<<"\tLogin : ";
cin>>wlogin;
cout<<"\tPass : ";
cin>>wpass;
if (verifident(wlogin, wpass))
{
cout<<"Identifiants OK";
}
}
bool identification::verifident(string wlogin, string wpass)
{
String^ var;
var = "SELECT * FROM utilisateur WHERE login='" + wlogin + "' AND pass='" + wpass + "'";
String^ connectString ="Data Source=MPDSI\\SQLEXPRESS;AttachDbFilename=E:\\ProjetC++\\bdd.mdf;Integrated Security=True;";
SqlConnection^ connection = gcnew SqlConnection();
connection->ConnectionString = connectString;
connection->Open();
// Objet Command
SqlCommand ^command = gcnew SqlCommand(var, connection);
// Objet DataReader
SqlDataReader ^reader = command->ExecuteReader();
if(reader->FieldCount !=0)
return true;
else
return false;
// Fermeture reader
reader->Close();
// Fermeture connection
connection->Close();
} |
Partager