Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
C#
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
Posted
Comments
Richard MacCutchan 6-Mar-15 3:26am    
DataAdapter and DataSet work on complete tables. You have to write your own code to extract particular fields.
Gerhard_Louis 6-Mar-15 11:05am    
Hi Richard.I used Chill60's suggestion and I can now extract just the fields I need.Thanks for replying in any case
Richard MacCutchan 6-Mar-15 12:23pm    
Yes, I should have spotted that. :(
CHill60 6-Mar-15 5:17am    
How about using string Sqltext = @"Select EmpNo from Clockd";
Gerhard_Louis 6-Mar-15 11:01am    
Thank you.Works perfectly.Really appreciate it

1 solution

Posting solution from my comment as OP has said it works.
string Sqltext = @"Select EmpNo from Clockd";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900