Hallo,
ich habe auf meinen Reseller Server eine MySQL Datenbank angelegt und externen zugriff erlaubt.
Nun würde ich gerne aus meiner Anwendung heraus dadrauf zugreifen.
Aber irgendwie ohne erfolg
Hier mal der Code
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:
| using System; using System.Collections.Generic; using System.Linq; using System.Text;
using MySql.Data; using MySql.Data.MySqlClient;
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { String connectionstring = "SERVER=xx.xx.xxx.xxx ;DATABASE=db;UID=username;PASSWORD=passwort;"; MySqlConnection connection = new MySqlConnection(connectionstring); MySqlCommand command = connection.CreateCommand(); MySqlDataReader reader; try { connection.Open(); command.CommandText = "SELECT * FROM kd;"; reader = command.ExecuteReader(); while (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) Console.WriteLine(reader.GetValue(i).ToString()); } connection.Close();
} catch (MySqlException mysqle) { Console.WriteLine(mysqle); } catch (Exception ex) { Console.WriteLine(ex); }
} } } |
Ein verweis auf die mysql.data.dll ist eingebunden.
Es kommt leider auch keine Fehlermeldung nur eine schwarze console.
Schonmal besten Dank für jegliche hilfe
mfg
mo
Moderiert von
Th69: Code- durch C#-Tags ersetzt