TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Violeta Popa
NA
137
164.4k
datagridview doesn't display records - MySQL db
Apr 21 2013 5:59 AM
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?
Reply
Answers (
1
)
How to Flush DNS Cache using .NET Inbuit Library Components
Adding multiselect to Gridview.