datagridview doesn't display records - MySQL db
Hello :) I've used a database in SQLSERVER2008, but because i couldn't connect in PHP to sqlserver, i've modified my database, and made it in MySQL. But now my datagridviews doesn't show anything..This is the code i'm using:
private void Form1_Load(object sender, EventArgs e)
{
DataSet dataSet = new DataSet();
BindingSource categdaBS = new BindingSource();
MySqlConnection conn = null;
string conStr = "server=localhost;User Id=root;database=asigurari";
conn = new MySqlConnection(conStr);
conn.Open();
MySqlDataAdapter daCategDA = new MySqlDataAdapter("SELECT * FROM categorie_discount_adaos", conn);
daCategDA.Fill(dataSet, "categorie_discount_adaos");
categdaGridView.AutoGenerateColumns = false;
categdaBS.DataSource = dataSet.Tables["categorie_discount_adaos"];
categdaGridView.DataSource = categdaBS;
categdaGridView.Columns["cod_categorie"].DataPropertyName = "cod_categorie";
categdaGridView.Columns["denumire_categorie"].DataPropertyName = "denumire_categorie";
categdaGridView.Columns["tip_categorie"].DataPropertyName = "tip_categorie";
categdaGridView.Columns["procent"].DataPropertyName = "procent";
conn.Close();
}
the connection works fine, but i don't know what's wrong, any help?