PRIMER INTERFASE DE DUOLINGO



codigo completo:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;

namespace Visual01
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
MySqlConnection Con = new MySqlConnection("data source=localhost;user id=root;password=;database=duolingo;");
Con.Open();
this.Text = Con.ServerVersion.ToString();
MySqlCommand C = new MySqlCommand("select distinct categoria from fortaleza", Con);
MySqlDataReader R = C.ExecuteReader();
while (R.Read())
{
comboBox1.Items.Add(R[0].ToString());
}
R.Close();
C = new MySqlCommand("select distinct ciudad from fortaleza", Con);
R = C.ExecuteReader();
while (R.Read())
{
listBox1.Items.Add(R[0].ToString());
}
R.Close();
C = new MySqlCommand("select id,categoria,ciudad from fortaleza", Con);
R = C.ExecuteReader();
while (R.Read())
{
ListViewItem I = new ListViewItem(R[0].ToString()+' '+
R[1].ToString()+' '+ R[2].ToString(), 1);
listView1.Items.Add(I);
}
}
}
}

No hay comentarios.:

Publicar un comentario