Solved

I have 4 FoxPro Tables and 3 MS Access I need to Read Records in Tables

Posted on 2008-10-06
9
213 Views
Last Modified: 2012-05-05
I have the data driver for FoxPro Installed.

I am using OLEDB so it doesn't matter the Database type.

I have 2 DataSet generated graphically.  (one for FoxPro and the other  Access)
 I would like to write code only (or maybe use code with the 2 graphically generated DataSets)


Steps I think I need:
Connection
DataSet
TableAdapter
Advance Record
Specify Field with String, not hard coded (i.e. strMyField = recRecord(strField))
0
Comment
Question by:JPTenore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 

Author Comment

by:JPTenore
ID: 22656110
Back in 30mins
0
 

Author Comment

by:JPTenore
ID: 22656826
No Comments Yet?!?  Maybe if I Break it up?
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22657045
FoxPro tables can come in either of two formats. They can be "free" tables, meaning that each table is independent of the others, or they can be part of a "database container" which holds metadata and allows additional features for the tables. If you see a file with a DBC extension then you've got a database.

Here are two connection strings:

*-- Free table directory
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro
Projects;Password="";Collating Sequence=MACHINE

*-- Database Container
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro
Projects\Test.DBC;Password="";Collating Sequence=MACHINE

(http://www.connectionstrings.com/)
 Using connection as new OleDbConnection("Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro Projects;Password='';Collating Sequence=MACHINE")
     connection.Open()
     ' Use the connection
 End Using

Open in new window

0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:JPTenore
ID: 22657117
WiFi went down, let me catch up
0
 

Author Comment

by:JPTenore
ID: 22657135
That Answers one Question I have Posted.  Also the FroPro data is 'Free Table'

Ask a Question for each step

Steps I think I need:
Connection (3 Questions for each Access, FoxPro, SQL Server)
DataSet
TableAdapter
Advance Record
Specify Field with String, not hard coded (i.e. strMyField = recRecord(strField))


You just got Connection - FoxPro (Hold on I will ask it)
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22657153
1. Connections:
- A. Foxpro (OLEDB)
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro Projects;Password="";Collating Sequence=MACHINE
- B. Access  (OLEDB)
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;
http://connectionstrings.com/?carrier=access
- C. SQL-server (SQLConnection)
Data Source=myServerAddress;Initial Catalog=myDataBase;User  Id=myUsername; Password=myPassword;
http://connectionstrings.com/?carrier=sqlserver2005
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22657156
2. Filling a dataset

Filling a DataTable or DataSet the Quick Way
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=406
private DataTable GetDataTable()
{
  string sql = "SELECT Id, Description FROM MyTable";
  using (SqlConnection myConnection = new SqlConnection(connectionString))
  {
    using (SqlCommand myCommand = new SqlCommand(sql, myConnection))
    {
      myConnection.Open();
      using (SqlDataReader myReader = myCommand.ExecuteReader())
      {
        DataTable myTable = new DataTable();
        myTable.Load(myReader);
        myConnection.Close();
        return myTable;
      }
    }
  }
}		

Open in new window

0
 

Author Comment

by:JPTenore
ID: 22657157
Here is the Question you Answered  ID:23792892   500pts. A Grade just post last Comment there
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 22657170
4. Loop datatable

        Dim dr As DataRow
        For Each dr In ds.Tables(0).Rows
            Dim i As Integer
            For i = 1 To ds.Tables(0).Columns.Count
                Console.Write("{0,15}", dr(i - 1))
            Next i
            Console.Write(vbCrLf)
        Next

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question