StonedMind
Mitglied
Hallo zusammen,
ich programmiere gerade eine GUI-Anwendung mit Visual C++ 2008, womit ich mittels eines MySQL Connectors/Net auf eine MySQL-Datenbank zugreife.
Allerdings fängt das Desaster schon damit an, dass ich die Bibliothek nicht vernünftig verwenden kann. Als erstes habe ich die DLL-File unter den Projekt-Eigenschaften erfolgreich bekannt gemacht.
Jetzt möchte ich im Quelltext den Namespace definieren!
Hier mein Code für meine Form1.h:
Da möchte ich dazusagen, dass die automatische Quelltextergänzung funktioniert. D.h. konkret in Zeile 12 tippe ich ein "using namespace M", dann drücke ich <Strg><Leertaste> und dann erscheint automatisch die Quelltextergänzung "MySQL".
Direkt danach tippe ich "::", drücke wieder <Strg><Leertaste> und es erscheint "Data", so wie es ja auch sein soll. Die komplette Einbindung sieht man oben in Zeile 12!
Hier der Code meiner Haupt.cpp:
Beim Ausführen bzw. Kompilieren erscheint folgende Fehlermeldung:
Form1.h(12) : error C2653: 'MySql' : is not a class or namespace name
Wie komme ich hier weiter?
Vielen Dank schon mal im Voraus für Eure Hilfe!
MfG
Andy
ich programmiere gerade eine GUI-Anwendung mit Visual C++ 2008, womit ich mittels eines MySQL Connectors/Net auf eine MySQL-Datenbank zugreife.
Allerdings fängt das Desaster schon damit an, dass ich die Bibliothek nicht vernünftig verwenden kann. Als erstes habe ich die DLL-File unter den Projekt-Eigenschaften erfolgreich bekannt gemacht.
Jetzt möchte ich im Quelltext den Namespace definieren!
Hier mein Code für meine Form1.h:
Code:
#pragma once
namespace Leisa_ODBC {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data::Odbc;
using namespace System::Data;
using namespace System::Drawing;
using namespace MySql::Data;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->SuspendLayout();
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
Da möchte ich dazusagen, dass die automatische Quelltextergänzung funktioniert. D.h. konkret in Zeile 12 tippe ich ein "using namespace M", dann drücke ich <Strg><Leertaste> und dann erscheint automatisch die Quelltextergänzung "MySQL".
Direkt danach tippe ich "::", drücke wieder <Strg><Leertaste> und es erscheint "Data", so wie es ja auch sein soll. Die komplette Einbindung sieht man oben in Zeile 12!
Hier der Code meiner Haupt.cpp:
Code:
#include "stdafx.h"
#include "Form1.h"
#include "windows.h"
using namespace Leisa_ODBC;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
Beim Ausführen bzw. Kompilieren erscheint folgende Fehlermeldung:
Form1.h(12) : error C2653: 'MySql' : is not a class or namespace name
Wie komme ich hier weiter?
Vielen Dank schon mal im Voraus für Eure Hilfe!
MfG
Andy