Bonjour, je dispose du code suivant :
dans le header correspondant, j'ai déclaré :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 void GamePanel::saveGame(int grid, int width, int boardColor, int p1tokenColor, int p2tokenColor, int difficulty) { try { strConnection = "Provider=Microsoft.Jet.OleDb.4.0;"; strConnection +=" Data Source=connect4.mdb"; connection = gcnew OleDbConnection(strConnection); connection->Open(); OleInsert = gcnew OleDbCommand( "grid=" + grid + "width=" + width + "boardColor=" + boardColor + "p1tokenColor=" + p1tokenColor + "p2tokenColor=" + p2tokenColor + "difficulty=" + difficulty + ";", connection ); int n = OleInsert->ExecuteNonQuery(); connection->Close(); } catch (System::Exception ^e) { System::Console::WriteLine(e); } }
En gros, j'aimerais sauvegarder les différentes int passés en argument à ma fonction saveGame dans ma BD access, mais lors de l'éxécution, j'ai l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 using namespace System; using namespace System::Data; using namespace System::Data::OleDb; ... ... private: String ^strConnection,^strCmd; OleDbConnection ^connection; OleDbCommand ^Olecmd,^OleInsert; OleDbDataReader ^dr;
Où est mon erreur ? Dois-je créer manuellement ma base de données Access avant d'éxécuter le code ?\GamePanel.cpp(135) : error C3624: 'System::Transactions::Transaction': use of this type requires a reference to assembly 'System.Transactions'
while importing type 'System:ata::Common:bConnection ' from assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
while importing type 'System:ata::OleDb::OleDbConnection ' from assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
.\GamePanel.cpp(135) : warning C4679: 'System:ata::Common:bConnection::EnlistTransaction' : could not import member
Merci d'avance
Partager