Comment puis-je me connecter à une base de données MySQL à partir de formulaires Windows? p>
4 Réponses :
ici est un article complet sur la connexion à MySQL en utilisant connecteur / NET 6.0 . P>
Vous pouvez également utiliser OLEDB pour se connecter à MySQL. P>
nombreux échantillons de chaînes de connexion ici: http://www.connectionstrings.com/ p>
merci mec..it est vraiment superb.im lovin ça !!
private void button1_Click(object sender, System.EventArgs e)
{
string MyConString = "SERVER=localhost;" +"DATABASE=mydatabase;"
"UID=testuser;" +"PASSWORD=testpassword;";
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "select * from mycustomers";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int i = 0;i<Reader.FieldCount;i++)
thisrow += Reader.GetValue(i).ToString() + ",";
listBox1.Items.Add(thisrow);
}
connection.Close();
}
i think this gonna be the simple one right!!!
but thanx all of u guys for responding and providing me the documentation!