Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string csatlakozasiadatok = @"server=localhost;userid=root;password='';database=kozlekedes"; //your database
- var connect = new MySqlConnection(csatlakozasiadatok); //your connection with var connect
- connect.Open();
- MySqlDataReader Reader; //reader for the values
- string leker = "SELECT `nev` FROM `metro` ORDER BY `nev` ; "; //SELECT name from metro table order by name
- var cmd = new MySqlCommand(leker,connect);
- cmd.CommandText = leker;
- Reader = cmd.ExecuteReader();
- while (Reader.Read())
- {
- string thisrow = "";
- for (int i = 0; i < Reader.FieldCount; i++)
- thisrow += Reader.GetValue(i).ToString();
- lbAdat1.Items.Add(thisrow);
- }
- connect.Close();
- //it's half-english and half-hungarian #sample for MySQL connection...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement