I use this tutorial [href] http://forums.mysql.com/read.php?38,5697,5697#msg-5697 [/href] to try to connect in Mysql database
but I obtain this error :
------ Build started: Project: Projet, Configuration: Release Win32 ------
Compiling...
projet.cpp
projet.cpp(13) : fatal error C1190: managed targeted code requires '#using <mscorlib.dll>' and '/clr' option
Build log was saved at "file://c:Documents and Settingsdidou69Mes documentsVisual Studio ProjectsCopie de ProjetReleaseBuildLog.htm"
Projet - 1 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
But when I put the "Use Managed Extensions"(in Configuration Properties) to "Yes" I obtain this error :
------ Build started: Project: Projet, Configuration: Release Win32 ------
Compiling...
cl : Command line error D2016 : '/GL' and '/clr' command-line options are incompatible
Build log was saved at "file://c:Documents and Settingsdidou69Mes documentsVisual Studio ProjectsCopie de ProjetReleaseBuildLog.htm"
Projet - 1 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
I think I make a murder !!!
This my full test code:
#define INITGUID
#include <dxdiag.h>
#ifdef _DEBUG
//#define new DEBUG_NEW
#endif
#include "DarkSDK.h"
//#include <mysql++.h>
//#include <iostream>
//#include <iomanip>
#using <mscorlib.dll>
#using <System.Dll>
#using <System.Data.Dll>
#using <System.Xml.Dll>
using MySql.Data.MySqlClient;
using namespace System;
using namespace System::Data;
using namespace System::Xml;
using namespace System::Collections;
using namespace MySql::Data::MySqlClient;
void DarkSDK(void)
{
// TODO: Add your control notification handler code here
MySqlConnection* objConn;
char* sConnectionString;
sConnectionString = "Password=mysql;User ID=root;Initial Catalog=Table;Data Source=localhost";
objConn = new MySqlConnection(sConnectionString);
//This sentence is the probleme.
//I get send to swich nSig, case AfxSigCmd_v and get the data
//Name: pTarget, Type: CcmdTarget* in the debug window
objConn->Open();
MySqlDataAdapter* daColumn1 = new MySqlDataAdapter("Select * From Column1 ", objConn);
DataSet* dsTable = new DataSet("Table");
daColumn1->FillSchema(dsTable,SchemaType::Source, "Column1");
daColumn1->Fill(dsTable,"Column1");
//daColumn1->MissingSchemaAction = MissingSchemaAction::AddWithKey;
//daColumn1->Fill(dsTable,"Column1");
DataTable* tblColumn1 = dsTable->Tables->Item["Column1"];
IEnumerator* iEnum = tblColumn1->Rows->GetEnumerator();
while(iEnum->MoveNext())
{
Console::WriteLine("{0} {1}",dynamic_cast<String*>(dynamic_cast<DataRow *>(iEnum->Current)->get_Item("au_fname")),
dynamic_cast<String*>(dynamic_cast<DataRow *>(iEnum->Current)->get_Item("au_lname")));
}
UpdateData(FALSE);
// loop until the escape key is pressed
while ( LoopSDK ( ) )
{
if ( dbEscapeKey ( ) )
return;
// update screen
dbSync ( );
}
}