jeudi 26 janvier 2017

Random strings SQL

I'm doing a chart using data into my database in a C# program. I have a list of users and i want to display in pseudo random order.

I've tried this code

void Button1Click(object sender, EventArgs e)
    {
        Connessione.Open();
        MySqlDataAdapter SDA=new MySqlDataAdapter("SELECT RAND() concorrente, id FROM Classifiche WHERE taglia='small' AND categoria='agility'",Connessione);
        DataTable DATA= new DataTable();
        SDA.Fill(DATA);
        dataGridView1.DataSource=DATA; 
        Connessione.Close();
    }

In this case, though, the query show me random numbers instead random strings. How can I fix it?




Aucun commentaire:

Enregistrer un commentaire