2009-07-09 25 views

Trả lời

0
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(); 
} 

tôi nghĩ rằng sẽ này là người đơn giản ngay !!! nhưng thanx tất cả các bạn u để trả lời và cung cấp cho tôi tài liệu!

Các vấn đề liên quan