如何在datagrid中获取sql值 [英] how to get sql values in datagrid
本文介绍了如何在datagrid中获取sql值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在尝试从sql数据库获取详细信息到我的WPF应用程序中.
但是表字段没有进入我的应用程序中,在此代码中进行了重新编码
hi all,
i am trying to get the details from sql database to in my WPF application.
but tables fields are not getting in my application regrading in this code
private void button1_Click(object sender, RoutedEventArgs e)
{
DataClasses1DataContext display = new DataClasses1DataContext();
var q = from a in display.GetTable<EMP>()
select a;
dataGrid1.ItemsSource = q;
}
有任何错误吗,是的,请任何人帮助我
在此先感谢........
}
is there any mistake ,is yes please any body help to me
thanks in advance........
推荐答案
请检查以下CP文章:
在本文中,您将获得有关如何在WPF DataGrid控件中从SQL Server数据库表显示数据的信息:
使用SQL Server数据库在WPF DataGrid控件中进行数据绑定 [ ^ ]
使用SQL Server Compact 3.5 Sp1的WPF中的DataGrid [ ^ ]
Please check following CP Articles:
In this article you will get information about how to display data from a SQL Server database table in a WPF DataGrid control:
Data binding in WPF DataGrid control using SQL Server database[^]
DataGrid in WPF using SQL Server Compact 3.5 Sp1[^]
我在xaml代码中进行了非常简单的更改……......我很困惑...
< dategird1 itemsource ="{Binding}">
i changed in xaml code very simple............i was confused...
<dategird1 itemsource="{Binding}">
如果在asp.net中,请使用显示成员和值成员属性以及databind函数.
使用以下窗口形式..
dataGrid1.DataMember =列名";您要显示的
写这一行.
如果这不起作用,请让我们知道即将发生的错误.
谢谢.
please use display member and value member property and databind function if it is in asp.net .
use following for window forms..
dataGrid1.DataMember="column name"; that you want to display
write this line.
If this Doesn''t works then please let us know about the error as well that is coming.
Thanks.
这篇关于如何在datagrid中获取sql值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文