如何从paradox表中选择一个字段 [英] How do I select a field from paradox table
本文介绍了如何从paradox表中选择一个字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从一个paradox表中选择一个特定字段。在我创建的示例应用程序中,我只能检索并将表加载到数据集中,而不仅仅是特定字段
这是我的代码
private void qButton1_Click( object sender,EventArgs e)
{
OleDbConnection oledbParadoxconn = new OleDbConnection();
{
string Sqltext = @ 从Clockd.EmpNo中选择*;
string oledbconnstr = Provider = Microsoft.Jet.OLEDB.4.0;数据源= c:\\Program Files \\Supertime\\db;扩展属性= Paradox 5.x;;
oledbParadoxconn.ConnectionString = oledbconnstr;
oledbParadoxconn.Open();
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(Sqltext,oledbParadoxconn);
DataSet dtgetdata = new DataSet();
myDataAdapter.Fill(dtgetdata, table1);
this .metroGrid1.DataSource = dtgetdata;
this .metroGrid1.DataMember = 表1跨度>;
}
有不同的选择方式来自悖论表的特定字段.Tlockd是表格,EmpNo是我想要使用的特定字段。
任何正确方向的帮助都将受到赞赏
解决方案
从我的评论中发布解决方案,因为OP说它有效。
字符串Sqltext = @从Clockd中选择EmpNo;
I am trying to select a specific field from a paradox table.In my sample app I created I can only retrieve and load the table into a dataset and not just a specific field
This my code
private void qButton1_Click(object sender, EventArgs e)
{
OleDbConnection oledbParadoxconn = new OleDbConnection();
{
string Sqltext = @"Select * from Clockd.EmpNo";
string oledbconnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Program Files\\Supertime\\db;Extended Properties=Paradox 5.x;";
oledbParadoxconn.ConnectionString = oledbconnstr;
oledbParadoxconn.Open();
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(Sqltext, oledbParadoxconn);
DataSet dtgetdata = new DataSet();
myDataAdapter.Fill(dtgetdata, "table1");
this.metroGrid1.DataSource = dtgetdata;
this.metroGrid1.DataMember = "table1";
}
Is there a different way to select a specific field from a paradox table.The Clockd is the table and the EmpNo is the specific field I want to use.
Any help in the right direction would be appreciated
解决方案
Posting solution from my comment as OP has said it works.
string Sqltext = @"Select EmpNo from Clockd";
这篇关于如何从paradox表中选择一个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文