Oprette forbindelse til MySQL database
Jeg har installeret Visual Studio express, MySQL 5.0 samt mysql-connector-odbc-3.51.12. Jeg ønsker at connecte til MySQL databasen fra en C# class. Jeg har følgende meget simple kode:using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Odbc;
class Class1
{
public static void Main(string[] args)
{
MySqlCon con = new MySqlCon("Database=xxxx;Data Source=localhost;User Id=xxxx;Password=xxxx");
con.Open();
MySqlCommand sel = new MySqlCommand("SELECT * FROM xxxx", con);
con.Close();
}
}
Jeg får følgende fejl:
Error 1 The type or namespace name 'MySqlCon' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Thomas Thorup\Local Settings\Application Data\Temporary Projects\DBConnect\Class1.cs 11 13 DBConnect
Error 2 The type or namespace name 'MySqlCon' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Thomas Thorup\Local Settings\Application Data\Temporary Projects\DBConnect\Class1.cs 11 32 DBConnect
Error 3 The type or namespace name 'MySqlCommand' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Thomas Thorup\Local Settings\Application Data\Temporary Projects\DBConnect\Class1.cs 13 13 DBConnect
Error 4 The type or namespace name 'MySqlCommand' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Thomas Thorup\Local Settings\Application Data\Temporary Projects\DBConnect\Class1.cs 13 36 DBConnect
Skal jeg pege ud på min MySQL connector eller mangler jeg blot en "using xxxx;"?!?