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
Haidon Diogenes
NA
21
6.9k
DataGridView in WPF
Feb 10 2016 7:08 AM
Hello , I want to make a DataGridView with the server data. It does not work and I think that is when >>> dgvPerfil.DataContext = dtPre1 ; <<< Below is the code in the method, the DataGridView is called dgvPerfil , and he will receive the connection string when the method is called . What am I missing ? Thank you all for your help.
public void ListPerfil(String verrdgda)
{
ConectionClass coneli = new ConectionClass();
cone.connect();
SqlCommand cverrdgda = new SqlCommand(verrdgda, cone.con);
try
{
SqlDataAdapter objsql1 = new SqlDataAdapter(cverrdgda);
DataTable dtPre1 = new DataTable();
objsql1.Fill(dtPre1);
dgvPerfil.DataContext = dtPre1;
}
catch
{
MessageBox.Show("Connecting to the server unavailable!", "Error");
cone.disconnect();
}
finally
{
coneli.desconectar();
}
}
Reply
Answers (
4
)
WPF->Parent and child Form
Wpf Layout and where is stackpanel added within the grid